<daurnimator>
ifreund: "libc doesn't offer a cos() that takes a float" -> what about `cosf`?
<daurnimator>
and then there's also tgmath.h
ur5us has quit [Ping timeout: 264 seconds]
marijnfs2 has joined #zig
<marijnfs2>
does anyone have opensuse? i have trouble with getting zig to find llvm
mjsir911 has joined #zig
marijnfs2 has quit [Client Quit]
marijnfs2 has joined #zig
<mjsir911>
Hello all o/. I need to assert structs(or, easier: tuples) with strings are equal but I can't because strings are pointers and testing compares pointers in structs literally. what can I do?
<marijnfs2>
mjsir911: use std.mem.eql
<marijnfs2>
there is more in std/mem.zig
<mjsir911>
ah, so I need to manually compare every field?
gazler_ has quit [Remote host closed the connection]
gazler_ has joined #zig
<marijnfs2>
yeah or you make a comptime function, that's more complicated
<mjsir911>
alright, thank you marijnfs2 ! Looking through testing.zig it seems to do array comparisons sometimes, but only with actual .Array types which I think need known lengths at compile time
ur5us has joined #zig
marler8997 has quit [Ping timeout: 272 seconds]
CommunistWolf has quit [Ping timeout: 264 seconds]
ur5us_ has joined #zig
gazler has joined #zig
gazler_ has quit [Read error: Connection reset by peer]
ur5us has quit [Ping timeout: 272 seconds]
CommunistWolf has joined #zig
<g-w1>
mem.eql can also do it with slice
<daurnimator>
there's also std.meta.eql, but it too doesn't follow pointers
slact has quit [Ping timeout: 272 seconds]
sebonirc has quit [Quit: sebonirc]
<andrewrk>
g-w1, have a look at the commit I just pushed
<andrewrk>
it's related to optionals/error sets zir/tzir
ur5us_ has quit [Read error: Connection reset by peer]
ur5us_ has joined #zig
<g-w1>
yep, im having to rebase a LOT on 7628 rn ;) but at least its unblocked
<g-w1>
are there any parts of stage2 that are not prone to merge conflicts?
<g-w1>
sooo close to catch at comptime!
marijnfs2 has quit [Quit: WeeChat 3.0]
<andrewrk>
g-w1, it's organized pretty decently to avoid conflicts I think - you're dealing with conflicts precisely because we implemented the same thing in different ways
<andrewrk>
also the reason I worked on the same thing as you was to help merge your PR - so the conflicts are due to us working together on the same thing. I think it's natural and OK
<andrewrk>
s/it's/conflicts are/
<g-w1>
ok nice. well 7628 is basically ready for review now. I just need to look it over in the morning and then its ready.
<andrewrk>
cool
<andrewrk>
hmm it occurred to me that `zig cc` could be doing LTO automatically (or at least make it as simple as -fLTO)
slact has joined #zig
a_chou has joined #zig
<daurnimator>
andrewrk: have you had any further thoughts of our discussion after 7638 ?
<andrewrk>
no
a_chou has quit [Remote host closed the connection]
ur5us_ has quit [Ping timeout: 260 seconds]
archdria has joined #zig
kameliya[m] has joined #zig
archdria has quit [Quit: Connection closed]
leon-p has joined #zig
jukan has joined #zig
jukan has quit [Quit: leaving]
jukan has joined #zig
sord937 has joined #zig
<mjsir911>
whats the point of a while(optional) || {} else {} construct? Isn't this equivalent to code after the while loop?
billzez has joined #zig
<kameliya>
when you break; from a while, the else {} doesn't get run.
<mjsir911>
Ah, that is useful, ty kameliya !
<mjsir911>
not very clear in the manual :P
<kameliya>
you can also break with a value. if it doesn't break, the else branch's value is used.
<kameliya>
heh, i'm just reading from it :p
<kameliya>
check the "rangeHasNumber" example for an example that uses break and else with values.
<mjsir911>
ah I see, just needed to look up a bit from the labelled while I was looking at
<kameliya>
finally, the source itself for the stdlib (i.e. the parts written in zig) is very readable, when you need to find a function. the autogen'd docs are not superb at the moment.
<kameliya>
ahh right
<mjsir911>
Yeah I've been having a good time with the source. Thanks a lot!
billzez has quit [Quit: WeeChat 2.8]
<kameliya>
great! np!
waleee-cl has quit [Quit: Connection closed for inactivity]
decentpenguin has quit [Quit: ZNC crashed or something]
decentpenguin has joined #zig
tnorth_ has joined #zig
jukan has quit [Ping timeout: 246 seconds]
tane has joined #zig
<tane>
howdy
<kameliya[m]>
howdy!
frett27_ has joined #zig
<FireFox317>
andrewrk, `var opt_val: ?i32 = 10; var val1: i32 = opt_val.?;` does not make it to TZIR. `expected i32, found ?i32`
frett27_ has quit [Ping timeout: 240 seconds]
ur5us_ has joined #zig
midgard_ has quit [Ping timeout: 264 seconds]
midgard has joined #zig
ur5us_ has quit [Quit: Leaving]
<ifreund>
daurnimator: even cosf uses doubles internally (at least musl does)
hnOsmium0001 has quit [Quit: Connection closed for inactivity]
slact has quit [Remote host closed the connection]
<tane>
is there something like @compileLog that doesn't induce compilation errors?
<tane>
from that discussion I don't get what the future plan is
uael has joined #zig
<FireFox317>
tane, i think in the current implementation of stage2 a `compileLog` does not immidiately end analysis, but still continues, so you can have multiple `compileLog`s. But at the end the compiliation will still fail
<tane>
yes
<FireFox317>
that is better right?
<tane>
it's better but still bad
<tane>
anyway, I can live with that for now :)
<FireFox317>
unfortunately stage2 is still far from finished haha
<uael>
hello, I would like to start playing with the sources, does anyone has a shell.nix to share ?
_whitelogger has joined #zig
ky0ko1 has joined #zig
<uael>
dutchie working, thanks
v0idify has joined #zig
v0idifyy has quit [Ping timeout: 268 seconds]
riba has quit [Ping timeout: 264 seconds]
uael has quit [Quit: Ping timeout (120 seconds)]
uael has joined #zig
jukan has joined #zig
jukan has quit [Ping timeout: 272 seconds]
ifreund has quit [Ping timeout: 256 seconds]
ifreund has joined #zig
v0idify has quit [Remote host closed the connection]
v0idify has joined #zig
kameliya has quit [Quit: connection reset by purr]
FireFox317 has quit [Ping timeout: 272 seconds]
TheLemonMan has joined #zig
Gliptic has quit [*.net *.split]
casaca has quit [*.net *.split]
cCCCCcccccCCc has quit [*.net *.split]
tines9 has quit [*.net *.split]
yeti has quit [*.net *.split]
dbohdan has quit [*.net *.split]
halbeno has quit [*.net *.split]
bens has quit [*.net *.split]
drewr has quit [*.net *.split]
lohengrin has quit [*.net *.split]
lohengrin has joined #zig
halbeno has joined #zig
dbohdan has joined #zig
bens has joined #zig
Gliptic has joined #zig
yeti has joined #zig
tines9_ has joined #zig
drewr has joined #zig
cole-h has quit [Ping timeout: 240 seconds]
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
FireFox317 has joined #zig
<g-w1>
andrewrk: are we moving away from the analyzeInst pattern in zir_sema and just doing the name of the inst?
ltr has joined #zig
Xatenev has joined #zig
ltr has quit [Quit: leaving]
Akuli has joined #zig
albertito has quit [Ping timeout: 240 seconds]
albertito has joined #zig
Xatenev has quit [Ping timeout: 265 seconds]
albertito has quit [Ping timeout: 246 seconds]
albertito has joined #zig
donniewest has joined #zig
ltr has joined #zig
FireFox317 has quit [Remote host closed the connection]
FireFox317 has joined #zig
l1x has joined #zig
uael has quit [Quit: Ping timeout (120 seconds)]
jukan has joined #zig
jukan has quit [Ping timeout: 246 seconds]
marijnfs has quit [Quit: WeeChat 2.8]
leeward has joined #zig
albertito has quit [Ping timeout: 260 seconds]
albertito has joined #zig
waleee-cl has joined #zig
hnOsmium0001 has joined #zig
albertito has quit [Ping timeout: 264 seconds]
albertito has joined #zig
albertito has quit [Ping timeout: 256 seconds]
tnorth_ has quit [Ping timeout: 260 seconds]
albertito has joined #zig
cCCCCcccccCCc has joined #zig
xackus_ has joined #zig
nvmd has joined #zig
leeward has quit [Ping timeout: 256 seconds]
ifreund has quit [Ping timeout: 256 seconds]
ifreund has joined #zig
leon-p has quit [Ping timeout: 256 seconds]
layneson has joined #zig
layneson has quit [Client Quit]
ltr has quit [Quit: leaving]
leon-p has joined #zig
xackus_ has quit [Ping timeout: 264 seconds]
sawzall has joined #zig
LanceThePants has quit [Ping timeout: 272 seconds]
l1x has quit [Quit: Connection closed for inactivity]
frett27_ has joined #zig
jukan has joined #zig
remby has joined #zig
fputs has joined #zig
xackus_ has joined #zig
jukan_ has joined #zig
jukan has quit [Ping timeout: 265 seconds]
wootehfoot has joined #zig
xackus_ has quit [Ping timeout: 240 seconds]
<andrewrk>
yes
hnOsmium0001 has quit [Quit: Connection closed for inactivity]
tdeo has joined #zig
tdeo has quit [Remote host closed the connection]
tdeo has joined #zig
remby has quit [Quit: Konversation terminated!]
leeward has joined #zig
<leeward>
Huh, all these constants, when preprocessed, are just translated to symbols for the linker script to replace. The addresses aren't even kept.
<leeward>
This is going to make automating this library's translation a bit harder.
xackus_ has joined #zig
<FireFox317>
leeward, im not sure what you are doing, but maybe using `var` will work
<justin_smith>
how hard would it be to to replace std.test.expect with something that bottoms out at the test location? a standard vim build tool integration will jump to the first item in the failure list, and that means it takes me from my failing test to std.testing/expect where it calls @panic
<justin_smith>
the straightforward thing of course is to replace `expect(foo)` with `if (foo) {} else @panic("test failure")` but maybe there's something nicer...
<justin_smith>
or of course if (!foo) @panic(...) - maybe that's good enough, I guess I rubber ducked it
<justin_smith>
actually that's better than test.expect because it lets me specify a failure message to go with the test
midgard_ has joined #zig
midgard has quit [Ping timeout: 256 seconds]
slact has joined #zig
<leeward>
FireFox317: I'm porting the SFR definitions for an embedded platform. All these addresses have to be volatile, so until we have volatile blocks or something like them it's just a bunch of pointers.
fritchie has quit [Remote host closed the connection]
fritchie has joined #zig
jukan has joined #zig
fputs has quit [Remote host closed the connection]
wootehfoot has quit [Read error: Connection reset by peer]
jukan_ has quit [Ping timeout: 256 seconds]
frett27_ has quit [Ping timeout: 244 seconds]
nvmd has quit [Quit: Later nerds.]
cole-h has joined #zig
zags has joined #zig
<zags>
hey
<zags>
defer file.close();
<zags>
scratch that
<zags>
error: expected type '[]const u8', found '[1024]u8'
<leeward>
Slice it.
<zags>
what's the zig way of converting that?
<ifreund>
you're missing a &
<ifreund>
which will give you a *[1024]u8 which coerces to []const u8
<zags>
oh I see
<leeward>
Or, if you don't want all 1024 bytes, use [0..n] where n is the number of bytes you do want.
<zags>
openFileAbsolute wanted a "[]const u8" so it was surprising to need taking the address here
<ifreund>
you can also do foo[0..] which gives you the full slice, though its a little more typing than just the &
<fengb>
Slices are fat pointers. Arrays are values in zig
<zags>
fengb: fat pointers as in pointer+length?
<g-w1>
yes
<zags>
So *[1024]u8 coercion to []const u8 sets the pointer to the first element and then sets length to 1024
<ifreund>
yep
<zags>
Thanks. Now, is it possible in openFileAbsolute to handle ONLY the FileNotFound error and then all the other errors separately? Listing all possible errors is brutal.
<Ristovski>
I know, just wanted to make sure there wasn't a reason before making a PR that would get rejected :P
Akuli has quit [Quit: Leaving]
FireFox317 has quit [Ping timeout: 264 seconds]
FireFox317 has joined #zig
<FireFox317>
andrewrk, i found another edge case regarding the type inferrence of blocks in stage2. It is at the bottom of this gist (https://gist.github.com/FireFox317/21a0109030491b3a81fe579b0052fe40). I did manage to implement something that patches up the TZIR after it has been generated in the block. I did this by calling mod.coerce and then adding the instructions that it generated. That felt a bit like a hack, so i was wondering what your
<FireFox317>
opinion is about this.
donniewest has quit [Quit: WeeChat 3.0]
<andrewrk>
I think this early in the design we should be extremely wary about things that feel like hacks
<andrewrk>
taking a look now, thanks for the code snippet
<andrewrk>
FireFox317, I get `error: TODO implement rlWrap .block_ptr` for your example
<andrewrk>
this is probably the case I was thinking of for why we would have thath result location
<FireFox317>
andrewrk, yes that is expected. i have a patch
<FireFox317>
andrewrk, hmm yeah that might be the case actually. But then still you cannot emit any instructions since you dont know the type of block yet.
<andrewrk>
I can tackle this test case now if you want
<andrewrk>
it's as good a task as any for stage2
<FireFox317>
andrewrk, that would be awesome yes. I'm interested in learning how you would implement that.
jukan_ has quit [Read error: Connection reset by peer]