<KIMI>
if i pass []const u8 string, and i store it in a struct variable same []const u8, what is size of struct? where string is stored?
<g-w1>
iirc a slice is just the same thing as a `struct { ptr: [*]u8, len: usize }` so it would be size + size = 128 bits on 64 bit system
<KIMI>
where it is stored? if i don't say [256] const u8, do i need to free memory?
a92 has quit [Quit: My presence will now cease]
<g-w1>
a string literal ("this") is stored directly in the binary, and any other []const u8 you can choose how/where to store it. if you are getting it from an api, it should tell you if you own it now, and if you should free it
msingle has joined #zig
<KIMI>
ok thanks
msingle has quit [Ping timeout: 240 seconds]
KIMI has quit [Remote host closed the connection]
mokafolio has quit [Quit: Bye Bye!]
mokafolio has joined #zig
frmdstryr has quit [Ping timeout: 260 seconds]
filpAM has quit [Ping timeout: 256 seconds]
xackus_ has joined #zig
xackus__ has joined #zig
xackus has quit [Ping timeout: 260 seconds]
xackus_ has quit [Ping timeout: 264 seconds]
jjsullivan has quit [Remote host closed the connection]
_whitelogger has joined #zig
<moinstar>
expected type '[]const u8', found '?[]const u8'
<moinstar>
how to convert '?[]const u8' to '[]const u8'
mwgkgk has quit [Quit: Connection closed for inactivity]
ur5us_ has quit [Ping timeout: 264 seconds]
KIMI has joined #zig
nebulaek has joined #zig
GuerrillaMonkey has joined #zig
Jeanne-Kamikaze has quit [Remote host closed the connection]
knebulae has quit [Read error: Connection reset by peer]
Stephanie has quit [Ping timeout: 240 seconds]
Stephie has joined #zig
<daurnimator>
moinstar: `orelse` ?
marnix has joined #zig
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
_whitelogger has joined #zig
dumenci has joined #zig
SimonNa has joined #zig
supercoven has joined #zig
supercoven has quit [Max SendQ exceeded]
supercoven has joined #zig
dumenci has quit [Remote host closed the connection]
ur5us_ has joined #zig
xackus__ has quit [Ping timeout: 272 seconds]
waleee-cl has quit [Quit: Connection closed for inactivity]
_whitelogger has joined #zig
_whitelogger has joined #zig
xentec has quit [Quit: memento mori]
xentec has joined #zig
<KIMI>
is there a good library for parsing text line by line?
<KIMI>
or an API
GuerrillaMonkey has quit [Remote host closed the connection]
<daurnimator>
KIMI: split into lines (with e.g. `.readUntilDelimiter*`) then write a parser for whatever you need within the line
<KIMI>
what is it from?
sord937 has joined #zig
<daurnimator>
KIMI: its part of the reader interface
jjsullivan has joined #zig
ur5us_ has joined #zig
cole-h has quit [Ping timeout: 260 seconds]
hlolli__ has joined #zig
hnOsmium0001 has quit [Quit: Connection closed for inactivity]
ur5us_ has quit [Ping timeout: 264 seconds]
karchnu has quit [Ping timeout: 272 seconds]
msingle has joined #zig
karchnu has joined #zig
nebulaek has quit [Quit: Leaving]
knebulae has joined #zig
msingle has quit [Ping timeout: 256 seconds]
lucid_0x80 has joined #zig
msingle has joined #zig
frmdstryr has joined #zig
radgeRayden has joined #zig
samtebbs has joined #zig
KIMI has quit [Ping timeout: 245 seconds]
waleee-cl has joined #zig
donniewest has joined #zig
donniewest has quit [Ping timeout: 240 seconds]
sawzall has quit [Read error: Connection reset by peer]
lucid_0x80 has quit [Ping timeout: 240 seconds]
sawzall has joined #zig
lucid_0x80 has joined #zig
donniewest has joined #zig
sord937 has quit [Remote host closed the connection]
sord937 has joined #zig
nvmd has joined #zig
ziguana[m] has joined #zig
virkony has quit [Ping timeout: 264 seconds]
ggVGc has quit [Changing host]
ggVGc has joined #zig
hnOsmium0001 has joined #zig
marnix has quit [Ping timeout: 264 seconds]
marnix has joined #zig
radgeRayden has quit [Ping timeout: 272 seconds]
cole-h has joined #zig
<hlolli__>
is there a way to print pointer address? I'm asking to debug a case where I'm not sure if an object is the same or different.
<g-w1>
"{*}
<hlolli__>
thanks g-w1 ! std.debug.print("ptr={*}\n", .{ptr}); from the docs :)
googlebot[m] has joined #zig
hcnelson[m] has joined #zig
THFKA4 has left #zig ["WeeChat 2.9"]
Jeanne-Kamikaze has joined #zig
lucid_0x80 has quit [Quit: Leaving]
hcnelson[m] is now known as hcnelson
df[m] has left #zig ["User left"]
voidshine has joined #zig
voidshine has quit [Client Quit]
voidshine has joined #zig
voidshine has quit [Client Quit]
skuzzymiglet has joined #zig
tane has joined #zig
<hlolli__>
Are the std.log loggers made to be eliminated when compiling to an optimized binary?
skuzzymiglet has quit [Remote host closed the connection]
<ifreund>
hlolli__: they can be
skuzzymiglet has joined #zig
<ifreund>
you can customize the behavior by defining your own log function in your root source file
<hlolli__>
it seems to be default tough?
<ifreund>
indeed
<ifreund>
they aren't all eliminated though, only the lower priority ones
<hlolli__>
ok then I don't worry :) I use these log calls extensively, I was under the impression that wasm32-wasi was broken with optimizations, but when I also encountered it on x86_32-linux, I realized it must be removed.
<hlolli__>
std.log.info to be percise, low priority indeed
<ifreund>
you can override this behavior by setting the log level manually instead of letting the std determine it based off of build mode
<hlolli__>
another question since you mentioned root source file, I've noticed that it's bit tricky to test files in isolation. If I want to test a nested file which imports file in ancestor directory, I'll get an error. Which I'm able to bypass with aliases. I don't know a good workflow to solve this, but I can solve it with --pkg-begin and --pkg-end statements
<hlolli__>
in context of std.log, I'd love to create a namespace-ish file for my own loggers, but I'm afraid it would be a hassle to import them if I'm frequently changing from runnin build-exe, build.zig and zig test interchangably.
<ifreund>
I'd recommend using a file in the toplevel directory of your project as a root test file and importing the others from their
<ifreund>
you can add a test step to your build.zig
<ifreund>
once you have a build.zig set up you should only need zig build really
<hlolli__>
true, but I'd need to create build step for each and every file if I'd want to run one file at a time?
Mat5 has joined #zig
<hlolli__>
but toplevel file for testing, which I'd comment out imports could work well actually.
<ifreund>
you can also have build options which cause different things to be tested
<ifreund>
build.zig is normal, turing complete zig code, anything is possible
Mat5 has quit [Client Quit]
<hlolli__>
yes, I guess someone needs to create a nice testing framework with file watchers, aliases and glob file selectors.
<hlolli__>
:) all good
<ifreund>
that's certainly possible, just waiting for someone to do it :P
Ashpool has joined #zig
KIMI has joined #zig
skuzzymiglet has quit [Ping timeout: 240 seconds]
ur5us_ has joined #zig
Ashpool_ has joined #zig
Ashpool has quit [Ping timeout: 240 seconds]
supercoven has quit [Ping timeout: 240 seconds]
sord937 has quit [Quit: sord937]
skuzzymiglet has joined #zig
skuzzymiglet has quit [Read error: No route to host]
<andrewrk>
it's designed to be declarative though. there are things that are more and less portable to do inside a build.zig
<andrewrk>
this will become more obvious during the release cycle where we work on the package manager
Jeanne-Kamikaze has quit [Ping timeout: 240 seconds]
gpanders has quit [Ping timeout: 260 seconds]
gpanders has joined #zig
<g-w1>
is there any reason why stage2 relies on the system standard library instead of the one already in the zig repo? I have been having trouble with wrong versions of the standard library when developing stage2, but don't want to build the compiler release every time the repo updates. I think a good solution to this would just be to override std to be lib/std/std.zig if this is possible for stage2. or am
<g-w1>
I missing something?
samtebbs has quit [Remote host closed the connection]
<andrewrk>
g-w1, zig looks for the lib/ files relative to its own binary path, starting in the same directory and then searching upwards at parent directories
<andrewrk>
could it be that zig build installed the lib/ files into the build/ directory next to the zig binary, and those are the ones being detected?
<andrewrk>
you can run `zig env` to print the detected lib/ directory
kristoff_it has quit [Ping timeout: 264 seconds]
<g-w1>
I think my problem is that the version of zig that I am using is newer than the version of the compiler I am working on so the standard library is mismatched. My question was why doesn't stage2 just use the standard library in the zig repo? IMO this would make things simpler. a way to fix this would be for me to build zig myself, but would have to manage different zig versions that I built based on
<g-w1>
different branches I am working on. I guess I could make a command that symlinks my global zig lib directory to the one in the zig repo, but I feel like it would be overcomplicating things
<g-w1>
is it possible to override the stdlib from a build.zig file?
KIMI has quit [Remote host closed the connection]
<g-w1>
I am using a zig binary download from the website, but want to use the standard library in the repo for stage2. I realize that it may not have been clear before
<andrewrk>
what is stage2 doing that is not using the standard library in the zig repo?
<andrewrk>
s/that is not/instead of/
<g-w1>
expected type 'std.builtin.Signedness', found bool; no member named 'is_signed' in struct 'std.builtin.Int'
<andrewrk>
I mean, where is that std lib that is not the one in the zig repo?
<andrewrk>
you shouldn't have to do this, I recommend *not* doing this: in build.zig: foo.override_lib_dir = "other/path/lib";
<andrewrk>
you need to use a lib dir that matches the zig compiler. I'm confused how you got into this situation
<andrewrk>
do you just need to run `make`?
<g-w1>
ok. I guess I can just rebase with master every so often if this happens.
donniewest has quit [Quit: WeeChat 3.0]
<andrewrk>
I don't understand - how did this happen?
<andrewrk>
when you update the std lib you have to rebuild the compiler
<g-w1>
I tried to use the master compiler and stdlib from the website from today to compile stage2 from 2 days ago. should I always be doing ./build/zig build instead of zig build
jjsullivan has quit [Ping timeout: 264 seconds]
<g-w1>
I just rebased and it worked :). my lesson: make sure everything is up to date. thanks
skuzzymiglet has joined #zig
jjsullivan has joined #zig
marnix has quit [Ping timeout: 260 seconds]
<andrewrk>
np
tane has quit [Quit: Leaving]
skuzzymiglet has quit [Ping timeout: 264 seconds]
layneson has joined #zig
ur5us_ has quit [Remote host closed the connection]