ChanServ changed the topic of #zig to: zig programming language | https://ziglang.org | be excellent to each other | channel logs: https://irclog.whitequark.org/zig/
<justin_smith> andrewrk: right, it's a nullable pointer
<justin_smith> I'm following the design of the async stack for a lockfree variant, it uses a null pointer for the bottom of the stack
<justin_smith> the same test that atomic stack uses passes, except once every N runs a failed op near bottom of stack is mistaken for a success and then there's an NPE
xd1le has quit [Remote host closed the connection]
_whitelogger has joined #zig
ur5us_ has quit [Ping timeout: 260 seconds]
ur5us_ has joined #zig
rzezeski has joined #zig
GrooveStomp has quit [Remote host closed the connection]
earnestly has quit [Ping timeout: 256 seconds]
cole-h has quit [Quit: Goodbye]
cole-h has joined #zig
<andrewrk> justin_smith, so the return type of the cmpxchg will be ??T and the outer layer represents the cmpxchg value and then the value underneath will still be optional
mokafolio has quit [Quit: Bye Bye!]
mokafolio has joined #zig
mokafolio has quit [Client Quit]
mokafolio has joined #zig
mokafolio has quit [Client Quit]
mokafolio has joined #zig
mokafolio has quit [Client Quit]
mokafolio has joined #zig
mokafolio has quit [Client Quit]
mokafolio has joined #zig
agentultra has quit [Ping timeout: 240 seconds]
a_chou has quit [Ping timeout: 246 seconds]
marnix has joined #zig
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
<justin_smith> that seems strange, but OK
frett27_ has joined #zig
_whitelogger has joined #zig
mmohammadi9812 has joined #zig
waleee-cl has quit [Quit: Connection closed for inactivity]
<andrewrk> it's the same concept as a double pointer: **T
<justin_smith> with a double pointer there's a difference between a single deref and a double deref, but unless I'm very confused, there's no way to tell if a null from @cmpxchgWeak is a success (null on success) or a failure (returns actual value on failure, in this case it can be null)
ur5us_ has quit [Ping timeout: 260 seconds]
mattmurr has quit [Quit: ZNC 1.7.2+deb3 - https://znc.in]
marnix has quit [Ping timeout: 264 seconds]
marnix has joined #zig
<andrewrk> have you tried it?
<andrewrk> if (@cmpxchgWeak(...)) |optional_ptr| { // it didn't work } else { // it did work}
frett27_ has quit [Ping timeout: 240 seconds]
marnix has quit [Read error: Connection reset by peer]
cole-h has quit [Quit: Goodbye]
leonardoce has joined #zig
decentpenguin has quit [Read error: Connection reset by peer]
decentpenguin has joined #zig
marnix has joined #zig
marnix has quit [Read error: Connection reset by peer]
knebulae has quit [Read error: Connection reset by peer]
mmohammadi9812 has quit [Quit: I quit (╯°□°)╯︵ ┻━┻]
jjsullivan1 has joined #zig
jjsullivan has quit [Ping timeout: 260 seconds]
marnix has joined #zig
marnix has quit [Read error: Connection reset by peer]
earnestly has joined #zig
knebulae has joined #zig
FireFox317 has joined #zig
FireFox317 has quit [Client Quit]
<haliucinas> 0
haliucinas has quit [Quit: leaving]
haliucinas has joined #zig
<ikskuh> 1
<jjsullivan1> three
marnix has joined #zig
marnix has quit [Read error: Connection reset by peer]
<ifreund> 0b100
<justin_smith> andrewrk: yeah, that's effectively what my code was doing, and I think I had the wrong explanation for my once-in-thousands-of-executions bug. I still don't have the test in a state where it fails every time.
marnix has joined #zig
marnix has quit [Read error: Connection reset by peer]
ky0ko has quit [Quit: killed]
ky0ko has joined #zig
marnix has joined #zig
marnix has quit [Read error: Connection reset by peer]
xackus_ has joined #zig
marnix has joined #zig
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
marnix has quit [Read error: Connection reset by peer]
waleee-cl has joined #zig
leeward has joined #zig
marnix has joined #zig
marnix has quit [Read error: Connection reset by peer]
omglasers2 has joined #zig
leonardoce has quit [Remote host closed the connection]
leonardoce has joined #zig
mokafolio has quit [Quit: Bye Bye!]
mokafolio has joined #zig
a_chou has joined #zig
leonardoce has quit [Ping timeout: 260 seconds]
frett27_ has joined #zig
marnix has joined #zig
marnix has quit [Read error: Connection reset by peer]
frett27_ has quit [Ping timeout: 260 seconds]
marnix has joined #zig
Akuli has joined #zig
joey152 has joined #zig
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
frett27_ has joined #zig
LanceThePants has quit [Read error: Connection reset by peer]
LanceThePants has joined #zig
LanceThePants has quit [Read error: Connection reset by peer]
LanceThePants has joined #zig
cole-h has joined #zig
a_chou has quit [Quit: a_chou]
layneson has joined #zig
mokafolio has quit [Quit: Bye Bye!]
mokafolio has joined #zig
mokafolio has quit [Client Quit]
mokafolio has joined #zig
riba has joined #zig
marnix has quit [Read error: Connection reset by peer]
frmdstryr has joined #zig
marnix has joined #zig
<frmdstryr> How can I set define enum fields based on a comptime value?
<frmdstryr> Why does it attempt to access fields in a branch that is not used?
<frett27_> H7F is not a member
<frett27_> of fields
<frett27_> const fields = switch (chip) {
<frett27_> .g4 => G4F,
<frett27_> .h7 => H6F,
<frett27_> };
<ifreund> yeah, looks like you typo'ed H6F for H7F on line 25
<frmdstryr> Oh, typo, should be H7F, but it still doesn't work
<frmdstryr> It seems to eval both switch branches
<ifreund> not sure if that's supposed to work or not tbh
<ifreund> this seems like a rather roundabout way to accomplish the task though maybe I'm missing context
<frmdstryr> Trying to reuse code between different stm32 chips and the headers use different names for the same thing.
riba has quit [Ping timeout: 240 seconds]
<frett27_> why don't you just define the struc depending on the arch ? using comptime ?
<frett27_> i feel the const means at "comp time",
<frett27_> ?
<ifreund> frmdstryr: why not this? https://godbolt.org/z/W7PesP
CommunistWolf is now known as lupine
<frmdstryr> ifreund: Hmm, that should work I guess
_Vi has quit [Ping timeout: 272 seconds]
heitzmann has quit [Quit: The Lounge - https://thelounge.chat]
agentultra has joined #zig
<frmdstryr> Wrapping an an anon struct works... https://godbolt.org/z/PeW93e
<ifreund> weird
<ifreund> I think you have indeed found a bug there
<frett27_> isn't that simplier ? https://godbolt.org/z/cP5Mrj define structures, then the mapping
<frett27_> ?
<ifreund> uh, mapping isn't an enum there
<frett27_> don't think this is requierd ?
<frmdstryr> The chip headers are imported from another file so repeating the full path is not ideal, also some chips use the same fields
<frmdstryr> Yeah that would work.
gulli222 has joined #zig
gulli222 has quit [Quit: Going offline, see ya! (www.adiirc.com)]
jjsullivan__ has joined #zig
frmdstryr has quit [Ping timeout: 256 seconds]
cole-h has quit [Quit: Goodbye]
ur5us_ has joined #zig
mattnite has joined #zig
<mattnite> AlbinoDrought yoooooo
wootehfoot has joined #zig
lupine is now known as CommunistWolf
layneson has quit [Ping timeout: 260 seconds]
_Vi has joined #zig
marijnfs has joined #zig
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
<AlbinoDrought> hi mattnite
<mattnite> how long have you been on irc?
<mattnite> for zig*
<mattnite> are you a ziguana now?
agentultra has quit [Remote host closed the connection]
<AlbinoDrought> maybe like a week or something, but nope not yet
<AlbinoDrought> working on it though... maybe for hacktoberfest 😎
<mattnite> ooh that's awesome
marijnfs has quit [Ping timeout: 260 seconds]
mattnite has quit [Remote host closed the connection]
Akuli has quit [Quit: Leaving]
frmdstryr has joined #zig
xackus_ has quit [Ping timeout: 256 seconds]
frmdstryr has quit [Ping timeout: 256 seconds]
frmdstryr has joined #zig
frmdstryr has quit [Ping timeout: 256 seconds]
marnix has quit [Remote host closed the connection]
marnix has joined #zig
radgeRayden has quit [Ping timeout: 272 seconds]
layneson has joined #zig
<andrewrk> ifreund, I'm interested to hear your experience using tdeo's opaque patch
<andrewrk> after you've had a chance to play with it for a while
<ifreund> andrewrk: for sure, I'll ping or comment on the PR or something
<ifreund> started playing with it already and it looks like it will clean things up a lot
<andrewrk> you're doing great work tdeo
<tdeo> thanks :)
_Vi has quit [Ping timeout: 272 seconds]
<ifreund> using the PR makes zls break and I lose my semantic highlighting :(
<ifreund> first world problems I know
<tdeo> compiling zls with the patched zig fixes that
<tdeo> no changes actually needed
<ifreund> oh neat, lemme do that real quick
omglasers2 has quit [Read error: Connection reset by peer]
wootehfoot has quit [Read error: Connection reset by peer]
jjsullivan__ has quit [Ping timeout: 260 seconds]
zippoh has quit [Ping timeout: 260 seconds]
BaroqueLarouche has quit [Ping timeout: 246 seconds]
iwq has quit [Ping timeout: 246 seconds]
oats is now known as oa
<ifreund> tdeo: you may have already fixed it, but I had to swap this int for a size_t on your latest commit https://paste.rs/Pbq.diff
<tdeo> oops
<tdeo> compiled fine for me, weird
<ifreund> i'm on gcc 9.3.0
<tdeo> think i'm using clang 10
iwq has joined #zig
<ifreund> hmm, I'm getting a crash trying to use it, but idk if it's directly related to your changes or not https://paste.rs/DUO
<tdeo> i think it is
layneson has quit [Ping timeout: 256 seconds]
<ifreund> let me push this code to a branch real quick then
<tdeo> i think i have a solution, wait
<tdeo> try adding ` opaque_type->data.unionation.resolve_status = ResolveStatusSizeKnown;` at the end of resolve_opaque_type in analyze.cpp
<tdeo> not unionation, opaque*
<tdeo> ah no that doesn't compile, sorry
<tdeo> are you trying to use it as an error union type?
<tdeo> without a pointer indirection
<tdeo> ifreund:
<ifreund> oh yeah I totally am but that's not what I wanted
<tdeo> i think that might have already been a bug
<ifreund> bet it works if I fix my broken code
<ifreund> nice, works now
frmdstryr has joined #zig
<tdeo> opened #6422
<ifreund> thanks
<ifreund> here's the diff migrating my highly WIP wayland-client bindings to opaque{} https://github.com/ifreund/zig-wayland/commit/bf0684066a107248357451905a58276ea8d58ee3
ur5us_ has quit [Ping timeout: 260 seconds]
<ifreund> it's a lot cleaner, and the implementation detail of the wrapper struct with a single opaque pointer field doen't leak into the listener callbacks
<tdeo> this isn't related to the feature, but are you planning to use wl_proxy_add_dispatcher instead of wl_proxy_add_listener?
<tdeo> i'd model events as a tagged union
<ifreund> Haven't decided yet, I need to look at the details
<ifreund> just went with what I'm familiar with for now
<tdeo> makes sense
ur5us_ has joined #zig
<ifreund> yeah, add_dispatcher looks promising, I think I'll have to try it out