waleee-cl has quit [Quit: Connection closed for inactivity]
Tharro has quit [Quit: ZNC 1.7.4+deb0+bionic0 - https://znc.in]
Tharro has joined #zig
B4s1l3 has joined #zig
B4s1l3 is now known as opDispatch
_Vi has joined #zig
dddddd has quit [Ping timeout: 256 seconds]
craigo has quit [Ping timeout: 265 seconds]
drp has quit [Ping timeout: 264 seconds]
dermetfan has joined #zig
drp has joined #zig
drp has quit [Quit: Leaving]
opDispatch has quit [Quit: Konversation terminated!]
swills has quit [Ping timeout: 256 seconds]
Tharro has quit [*.net *.split]
knebulae has quit [*.net *.split]
ifreund has quit [*.net *.split]
mikdusan has quit [*.net *.split]
cbarrett has quit [*.net *.split]
cncl has quit [*.net *.split]
alehander92 has quit [*.net *.split]
wjlroe has quit [*.net *.split]
l1x has quit [*.net *.split]
Cynthia has quit [*.net *.split]
kushalp has quit [*.net *.split]
tributarian has quit [*.net *.split]
lukeholder has quit [*.net *.split]
gonz_ has quit [*.net *.split]
lohengrin has quit [*.net *.split]
[RMS] has quit [*.net *.split]
commander has quit [*.net *.split]
ikskuh has quit [*.net *.split]
cow-orker has quit [*.net *.split]
Nilium has quit [*.net *.split]
jzelinskie has quit [*.net *.split]
euantor has quit [*.net *.split]
nikki93 has quit [*.net *.split]
_whitelogger has joined #zig
jjido has joined #zig
jjido has quit [Client Quit]
<Tharro>
Trying to make a sprintf implementation but somehow the array (`buffer` in the sample code) is not copied when returned as a slice because the output is garbage: https://www.godbolt.org/z/UXJvPc Can somebody explain me which assumptions are wrong here?
<daurnimator>
Tharro: sprintf8 returns a slice into the stack buffer `buffer` that is now stale
<daurnimator>
Tharro: a slice is just a pointer and a length
<Tharro>
Ok. Is there a way to transparently return an array of arbitrary length?
<daurnimator>
Tharro: have caller pass in buffer or allocator
<Tharro>
I've looked into the option of using an allocator but it seems there is no default/global allocator to allocate memory on the heap (e.g. the C malloc equivalent). Is that right?
<daurnimator>
correct
<pixelherodev>
I mean
<pixelherodev>
std.heap.page_allocator does that
<pixelherodev>
It's just not efficient
craigo has joined #zig
xackus has joined #zig
ask6155 has joined #zig
slowtyper has joined #zig
slowtype1 has quit [Ping timeout: 258 seconds]
dddddd has joined #zig
hermier has quit [Remote host closed the connection]
<ask6155>
hey, I'm trying to build cmake but cmake .. gives error 'could not find clang (missing: CLANG_LIBRARIES)'
<ask6155>
oops I'm trying to build zig
<ifreund>
ask6155: zig needs to link against clang, llvm, and lld. do you have the development libaries/headers for all of these installed?
<ask6155>
I have clang, lld, llvm, llvm-libs
<pixelherodev>
Ugh
<ifreund>
some distros split these into *-dev and normal packages, perhaps yours does that?
<ifreund>
you can also just do ./zig-cache/bin/foobar
<arend>
mikdusan but that doesnt work for me
<ifreund>
odd, what are you trying to run?
<arend>
nevermind
<arend>
I removed the zig-cache folder and rebuilt
<arend>
works now
<arend>
thanks guys
DrDeano has joined #zig
<DrDeano>
Hi, I am having some problems with ChildProcess where after I call `wait()`, I get a `OutOfMemory` but the error return trace says `PathAlreadyExists`
arend has quit [Remote host closed the connection]
dingenskirchen has quit [Quit: dingenskirchen]
dingenskirchen has joined #zig
kristoff_it has joined #zig
sarmonsiill has quit [Remote host closed the connection]
sarmonsiill has joined #zig
Xavi92 has joined #zig
dingenskirchen has quit [Ping timeout: 256 seconds]
fraktor has quit [Read error: Connection reset by peer]
aerona has joined #zig
craigo has quit [Ping timeout: 265 seconds]
decentpenguin has joined #zig
waleee-cl has joined #zig
dingenskirchen has quit [Remote host closed the connection]
frett27 has joined #zig
dingenskirchen has joined #zig
Akuli has joined #zig
<leeward>
Are there any graphics libraries that don't depend on libc?
<pixelherodev>
none that I'm aware of :(
<leeward>
:/
kristoff_it has quit [Ping timeout: 265 seconds]
<ifreund>
one downside of zig's lazy compliation is that code can stick around after a refactoring that never gets used
<ifreund>
do we have a plan to combat this?
<ifreund>
just found a function in my code that should have been deleted weeks ago
<Xavi92>
ifreund: +1. Also I've found some functions that had different kind of errors but zig would not check them since they're lazily compiled
<leeward>
I don't know of a plan, but something like `zig check` following all the comptime branches and noting dead code would certainly be useful.
<leeward>
Of course, it would have to know to ignore libraries.
<ifreund>
yeah a tool listing all the dead code would be a good start
<ifreund>
even better would be a tool that tests all permuations of target and build options
jjido has joined #zig
<leeward>
More important than just listing dead code, trying to compile branches not taken would expose errors.
jjido has quit [Client Quit]
<ifreund>
yeah, that would be crazy useful for CI
<leeward>
`if (someplatform) arr[17] else arr[2]` on an array with comptime known length of 3 won't fail unless someplatform is true.
aerona has quit [Quit: Leaving]
<leeward>
Is there a new translate_c bug that's keeping SDL2/SDL.h from importing?
<ifreund>
don't know, I'm not using sdl
<ifreund>
also still on 0.6.0 :P
<leeward>
heh
<leeward>
Do you use any graphics libraries?
<ifreund>
wlroots i guess
<ifreund>
though it's a lot more than a graphics library
<ifreund>
probably will need to though for some future wayland clients I'm planning on writing
<leeward>
mm, would consider if I were using wayland
<ifreund>
to be clear it's a library for wayland servers, not the average client :P
<ifreund>
all the graphics I do is just compositing what the clients send and drawing it to the display
<ifreund>
plus some borders and a background color
_Vi has joined #zig
jwmerrill has joined #zig
cole-h has joined #zig
<frett27>
ifreund: +1, face the same, it seems a best practice to add a unit test, then it is compiled when run ?
jjido has joined #zig
<ifreund>
frett27: yes, in an ideal world we wouldn't have this probelm as all code paths would be tested, however this is rarely the case in practice :)
<frett27>
ifreund: yes, but from my experience this saves a lot of times to have a small test to check memory allocation, or dump parameters,
<frett27>
ifreund: i must admit i don't have tests for all :-)
<ifreund>
yeah, tests can save a ton of time
<ifreund>
unfortunately writing tests for a wayland compsitor isn't all that easy and I have yet to look into how best to do it
<ifreund>
probably need to write a bunch of test clients and some kind of testing framework
<frett27>
ifreund: when compiling with build-obj, it should not strip symbols, is that a solution ?
<ifreund>
I think weston has a fair bit of test coverage, I think I can take inspiration from there
waleee-cl has quit [Quit: Connection closed for inactivity]
<ifreund>
frett27: not familar enough with how the compiler works to say
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
waleee-cl has joined #zig
doublex has quit [Ping timeout: 260 seconds]
jjido has joined #zig
satchmo has joined #zig
gpanders has joined #zig
benjif has joined #zig
frmdstryr has joined #zig
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
r4pr0n has joined #zig
doublex has joined #zig
<jwmerrill>
I'm working my way through the Zig cc blog post (https://andrewkelley.me/post/zig-cc-powerful-drop-in-replacement-gcc-clang.html), and I'm a little confused about how it uses QEMU. At one point, it does `qemu-aarch64 ./src/luajit` to execute a command on the target. I've never used QEMU before, and I'm having trouble finding documentation on how to invoke QEMU like that.
_Vi has quit [Read error: Connection timed out]
<jwmerrill>
I just installed QEMU through homebrew, and I see there's a binary called `qemu-system-aarch64` that can bring up an emulated machine, but I don't see how to get it to just run a single command like in the blog post.
jjido has joined #zig
<satchmo>
I think you're referring to QEMU's user mode emulation
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dingenskirchen1 has joined #zig
dingenskirchen has quit [Ping timeout: 256 seconds]
dingenskirchen1 is now known as dingenskirchen
sarmonsiill has quit [Ping timeout: 256 seconds]
doublex_ has quit [Ping timeout: 256 seconds]
_Vi has joined #zig
dermetfan has quit [Ping timeout: 256 seconds]
satchmo has quit [Quit: WeeChat 2.8]
dermetfan has joined #zig
BaroqueLarouche has quit [Ping timeout: 256 seconds]
doublex has joined #zig
<Xavi92>
ifreund: BTW, is there any reason why zig does lazy compilation? Is it to achieve faster compilation speed?
alexnask has joined #zig
<ifreund>
Xavi92: that, and it makes stuff like having differente dependencies based on a build option work
<ifreund>
In C you would do this with macros, but with zig comptime is the way
<ikskuh>
Xavi92: lazy compliation makes "not having a preprocessor" possible
<alexnask>
This is the way
<ikskuh>
and stuff like recursive data stuctures are also easier
<ifreund>
yeah
jjido has joined #zig
<leeward>
Xavi92: I think it's mainly about binary size. It only compiles the code that's used, even from the standard library.
jjido has quit [Client Quit]
<fengb>
It’s a pervasive design philosophy. I’m not sure why it was chosen but things like OS features are completely dependent on it
<alexnask>
^
ur5us has joined #zig
Akuli has quit [Quit: Leaving]
<frmdstryr>
Can I catch a whole error set in a switch?
<leeward>
frmdstryr: You mean like `ErrorSet.FirstValue, ErrorSet.SecondValue =>`?
<frmdstryr>
No like `ErrorSet =>` so i don't have to break each one out?
<leeward>
Or do you want to check for membership in the error set with a single switch branch?
<frmdstryr>
^^ yes that
<leeward>
I'm not sure, but I don't see an obvious way to do it. Looking through the builtins.
<leeward>
I don't think switch will do it.
<leeward>
I think I had this problem recently.
doublex has quit [Remote host closed the connection]
doublex has joined #zig
<leeward>
Yep, the code I ended up with sidestepped it.
<alexnask>
I tried writing a comptime ErrorDispatcher that did this at some point but Im pretty sure we need @Type(.ErrorSet) for it
<frmdstryr>
I'm trying to reduce a global error set to a known error set so I can use streams but it doesn't seem to work. I have to catch and explicitly return each one...
<alexnask>
Yes this is a weakness atm I think there was some github issue with a proposal that did something similar
<Xavi92>
thank you all for your comments. I'm not so sure about the binary size reason: many C compilers separate symbols into their own sections so the linker removes unused code, but I don't know how the compilation process works in zig tbh
<alexnask>
It would be pretty easy to do as a custom type with @Type(.ErrorSet) btw
<alexnask>
s/btw/though
<leeward>
Right, that's the thing, and it's not implemented yet.
<leeward>
Xavi92: Yeah, you're probably right.
<alexnask>
Yes as I said its a weakness atm
<leeward>
Well, that's distracting. That's a large number of people walking down the street.
<alexnask>
Not sure every linker eliminated dead code
<alexnask>
Anyway just compiling what you need in the first place is less wasteful imo
<Xavi92>
alexnask: surely not every linker, that's why I said "many"
<alexnask>
zig uses lld atm btw (in the C++ compiler)
<Xavi92>
alexnask: well, it ensures all code remains valid even if not used, but I understand why it was decided otherwise for zig
<fengb>
In Zig, not all code is valid. OS features are implemented with this caveat
_Vi has quit [Remote host closed the connection]
<leeward>
Oh hey, fengb, I've been meaning to ask: what do you use to draw on your wasm target?
<ifreund>
to be clear, you need lazy evaluation to be able to do many things that would be enabled by a preprocessor in C
<ifreund>
and a preprocessor has the same drawback of not compiling all the code
<leeward>
It's true, C compilers won't complain about code that's #ifdef'd out. Even if it doesn't parse.
<ifreund>
(among others)
<leeward>
At least Zig code that isn't compiled still has to parse.
<ifreund>
yeah
wootehfoot has quit [Read error: Connection reset by peer]
<frmdstryr>
alexnask: Using @TypeOf(write).ReturnType.ErrorSet, thanks for the tip!
<Xavi92>
sure
BaroqueLarouche has joined #zig
frett27 has quit [Ping timeout: 260 seconds]
pmwhite has quit [*.net *.split]
fengb has quit [*.net *.split]
AlexMax has quit [*.net *.split]
pmwhite has joined #zig
AlexMax has joined #zig
fengb has joined #zig
edr has quit [*.net *.split]
procnto has quit [*.net *.split]
utzig has quit [*.net *.split]
rappet has quit [*.net *.split]
AlexMax has quit [Max SendQ exceeded]
edr has joined #zig
procnto has joined #zig
utzig has joined #zig
rappet has joined #zig
DrDeano has quit [*.net *.split]
DrDeano has joined #zig
potta_coffee has quit [*.net *.split]
hspak has quit [*.net *.split]
WilhelmVonWeiner has quit [*.net *.split]
blueberrypie has quit [*.net *.split]
terinjokes has quit [*.net *.split]
potta_coffee has joined #zig
WilhelmVonWeiner has joined #zig
hspak has joined #zig
blueberrypie has joined #zig
terinjokes has joined #zig
potta_coffee has quit [Max SendQ exceeded]
ky0ko has quit [*.net *.split]
return0e[m] has quit [*.net *.split]
D3zmodos has quit [*.net *.split]
Bastian[m] has quit [*.net *.split]
sammich has quit [*.net *.split]
afontain_ has quit [*.net *.split]
rom1504 has quit [*.net *.split]
sammich has joined #zig
Bastian[m] has joined #zig
D3zmodos has joined #zig
afontain_ has joined #zig
ky0ko has joined #zig
return0e[m] has joined #zig
rom1504 has joined #zig
drewr has quit [*.net *.split]
zannzen[m] has quit [*.net *.split]
ifreund[m] has quit [*.net *.split]
Dominic[m] has quit [*.net *.split]
yawniek has quit [*.net *.split]
tdeo has quit [*.net *.split]
Snektron has quit [Ping timeout: 244 seconds]
metheflea has quit [Ping timeout: 244 seconds]
dtz has quit [Ping timeout: 246 seconds]
return0e[m] has quit [Ping timeout: 252 seconds]
D3zmodos has quit [Ping timeout: 252 seconds]
Bastian[m] has quit [Ping timeout: 252 seconds]
afontain_ has quit [Ping timeout: 252 seconds]
alva has quit [Ping timeout: 260 seconds]
hamoko[m] has quit [Ping timeout: 260 seconds]
<leeward>
Anyone know if there's an easy way to turn a sentinel-terminated pointer into a slice?
factormystic has quit [*.net *.split]
dch has quit [*.net *.split]
bjornroberg has quit [*.net *.split]
mgxm has quit [*.net *.split]
jmiven has quit [*.net *.split]
dottedmag has quit [*.net *.split]
casaca has quit [*.net *.split]
torque has quit [*.net *.split]
Cadey has quit [*.net *.split]
shachaf has quit [*.net *.split]
tyler569 has quit [*.net *.split]
torque has joined #zig
dottedmag has joined #zig
mgxm has joined #zig
jmiven has joined #zig
bjornroberg has joined #zig
casaca has joined #zig
tyler569 has joined #zig
factormystic has joined #zig
shachaf has joined #zig
dch has joined #zig
Cadey has joined #zig
<alexnask>
std.mem.spanZ I believe
m910q has quit [*.net *.split]
danyspin97 has quit [*.net *.split]
betawaffle has quit [*.net *.split]
scientes has quit [*.net *.split]
shodan45 has quit [*.net *.split]
nickster has quit [*.net *.split]
crimson_penguin has quit [*.net *.split]
yawniek has joined #zig
danyspin97 has joined #zig
m910q has joined #zig
betawaffle has joined #zig
shodan45 has joined #zig
scientes has joined #zig
nickster has joined #zig
crimson_penguin has joined #zig
tdeo has joined #zig
pmwhite has quit [Ping timeout: 244 seconds]
sammich has quit [Ping timeout: 252 seconds]
betawaffle has quit [Max SendQ exceeded]
fengb has quit [Ping timeout: 244 seconds]
xackus has quit [Ping timeout: 246 seconds]
BaroqueLarouche has quit [Ping timeout: 256 seconds]
betawaffle has joined #zig
BitPuffin has quit [Ping timeout: 272 seconds]
pltrz has quit [Ping timeout: 260 seconds]
nmeum has quit [Remote host closed the connection]
nmeum has joined #zig
<leeward>
alexnask: yep, thanks
<leeward>
Seems like span is just better than spanZ.
<leeward>
er, other way around
<leeward>
spanZ is safer.
Snektron has joined #zig
<Xavi92>
oh, just realized I'm also having issue #5340