<Dominic[m]>
As a continuation of my confusion, http://sprunge.us/1jiwH7 does not have any mix of A/B for me. But if A were backgrounded that should be the case I would think?
lunamn has quit [Ping timeout: 268 seconds]
lunamn has joined #zig
<schme245>
how can I do conditionals in my code that depend on the release mode?
<schme245>
I remember there's a builtin for that somewhere but I can't find it
<schme245>
found it, `builtin.mode`! but how come that variable is not defined anywhere in builtin.zig? 🤔
<mq32>
schme245: there's "zig builtin" and "std.builtin"
<mq32>
zig builtin delivers you with the runtime values
<schme245>
gotcha! I guess that is implemented somewhere in the C++ compiler then?
<daurnimator>
well I see one function in there; guess :)
<Dominic[m]>
It did cross my mind that loop iterations might "implicitly" suspend or something like that, in order to provide a way for the loop to pause.
<Dominic[m]>
It does seem like async is fairly undocumented outside of the places you can manually do it yourself. Reading the source of the zig os/fs/system stuff has been useful.
<Snektron>
Creating an ArrayList with T a union(enum) i get a broken module
<Dominic[m]>
Can I get a clue as to why this segfaults? I tried gdb but the 0x0 wasn't very useful.
mahmudov has joined #zig
<Dominic[m]>
http://sprunge.us/MxaaBO was this, figured it out. It's because the main exits. So I need to wait for the global loop to be empty.
nimar has joined #zig
<via>
is there a way to get `zig test` to only try compiling/running whats in `test` blocks? it seems to also be trying to compile exported functions
<via>
use case is trying to write a few unit tests in a file that works with lots of c code on an embedded target, the full source won't compile/link on the hosted target
lunamn has quit [Ping timeout: 258 seconds]
lunamn has joined #zig
schme245 has quit [Remote host closed the connection]
marmotini_ has joined #zig
marmotini_ has quit [Read error: Connection reset by peer]
marmotini_ has joined #zig
schme245 has joined #zig
<via>
i am really struggling to get a C []char* style array of strings to work when calling a C function
<Snektron>
via, you could extract the non-specific code to a different file and only run the tests in that file
<via>
i've tried a variety of things, but in gdb most of the parameters to that C function are mangled. the usb_strings symbol appears to be right in the final executable
<via>
e.g. it looks like just a list of addresses to what looks like the right strings
<via>
but yeah, strings is getting passed in as a null ptr
<Snektron>
i think usb_strigns should be a [_][*:0]const u8
<andrewrk>
Dominic[m], the evented-based file system I/O bitrotted with the new async/await implementation, and is ready for a rewrite now that new async/await is here
<via>
Snektron: i've tried that, but even if the data structure is wrong, its that a null is getting passed to the function instead of the address of usb_strings
<andrewrk>
Dominic[m], well, not a rewrite, just test coverage
<via>
its almost like there's a calling convention issue, but i've built the c library with the same target with clang
schme245 has quit [Remote host closed the connection]
DrDeano has joined #zig
<DrDeano>
I am trying to run my zig build test, but im getting a integer overflow in the std.os.linux.vdso.lookup
<fengb>
Since this isn't "true" recursion as it's a different generic type, this should theoretically be okay
<Dominic[m]>
Where last_vol is a ?u32, are there plans to make something .like this compile? `if (last_vol == null or new_vol != last_vol) {`
<Dominic[m]>
Looks like last_vol.? is the trick :)
<andrewrk>
fengb, yes
<andrewrk>
agreed
<fengb>
The codepath is pretty complex so I haven't gotten a reduced case yet :/
TheLemonMan has joined #zig
<TheLemonMan>
yo andrewrk, what do you think about letting the warnings from clang bubble up to the Zig side?
<andrewrk>
TheLemonMan, the "unused args" ones from assembly?
<TheLemonMan>
the ones from cimport/translate-c
bilebucket has quit [Quit: WeeChat 2.7]
<andrewrk>
ok so clang is giving us warnings, that is information we need to communicate to the programmer
<andrewrk>
I don't want clang to be in charge of stderr/stdout however
<andrewrk>
one thing we can do is put them inline with the translated code as comments
<andrewrk>
the problem I have with warnings is that if you repeat an operation, you don't get warnings the second time, and now you have people clearing the cache to get warnings again
DrDeano has quit [Remote host closed the connection]
<andrewrk>
warnings are inherently incompatible with incremental compilation
<TheLemonMan>
yeah it's a bit of a mess if you take everything into account
<andrewrk>
one idea might be to have warnings prevent a c object from getting cached...
<andrewrk>
if anyone wants a fun contributor friendly task, try adding as much test coverage to translate-c as you can with the new run-translated-c test harness
<andrewrk>
TheLemonMan, I'll work on merging callconv now
ur5us has joined #zig
euandreh has joined #zig
schme245 has quit [Remote host closed the connection]
<TheLemonMan>
oh that's neat, it should be pretty easy to review/rebase
<TheLemonMan>
there's also #3955 if you're after some lightweight PRs :)
<andrewrk>
looking
<andrewrk>
oh I wanted to look into this a little bit, there were some more edge cases I wanted to consider
schme245 has joined #zig
Akuli has quit [Quit: Leaving]
doublex has quit [Ping timeout: 258 seconds]
<Snektron>
Dominic: , you can achieve that with `if (last_vol == null or new_vol != last_vol.?)`
<Snektron>
Assumed new_vol is not optional
ky0ko17 has joined #zig
ky0ko has quit [Disconnected by services]
ky0ko17 is now known as ky0ko
ltriant has joined #zig
<Dominic[m]>
It is not, thanks!
<Dominic[m]>
I say this every week I'm here, but I have a lot of fun using Zig. Thank you!
<andrewrk>
glad you can get past the instability & churn :)
doublex has joined #zig
<via>
andrewrk: well, i did write a test for the packed struct thing that verified the sizeof output, but ran into https://github.com/ziglang/zig/issues/1481. for now i guess just compiling/running will have to do
ltriant has quit [Read error: Connection reset by peer]
ltriant has joined #zig
watzon has joined #zig
watzon has left #zig ["ERC (IRC client for Emacs 26.3)"]
<andrewrk>
via, ah, yes that C ABI issue is annoying
<andrewrk>
lunamn, your dns PR is almost next in the queue :)
doublex has quit [Ping timeout: 268 seconds]
doublex has joined #zig
<Snektron>
if a function taking var receives an anonymous array literal
<Snektron>
Is it a struct or an array?
neceve has quit [Remote host closed the connection]
<hryx>
Snektron: I think it just depends on how the var parameter is used inside the function