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/
<scientes> malloc/free is often a huge performance drain in C++/C apps
<scientes> both time and memory usage wise
<daurnimator> marijnfs_: not binary seialization, but is https://github.com/ziglang/zig/pull/3155 the sort of thing you have in mind?
lunamn has quit [Remote host closed the connection]
doublex has quit [Remote host closed the connection]
doublex has joined #zig
marijnfs_ has quit [Ping timeout: 264 seconds]
marijnfs_ has joined #zig
dingenskirchen has quit [Read error: Connection reset by peer]
dingenskirchen has joined #zig
marijnfs__ has joined #zig
marijnfs has quit [Ping timeout: 240 seconds]
waleee-cl has quit [Quit: Connection closed for inactivity]
_whitelogger has joined #zig
muffindrake has quit [Ping timeout: 245 seconds]
muffindrake has joined #zig
dingenskirchen has quit [Remote host closed the connection]
dingenskirchen has joined #zig
chemist69 has quit [Ping timeout: 246 seconds]
chemist69 has joined #zig
_whitelogger has joined #zig
_whitelogger has joined #zig
return0e_ has quit [Ping timeout: 245 seconds]
doublex_ has joined #zig
doublex has quit [Ping timeout: 264 seconds]
_whitelogger has joined #zig
FireFox317 has quit [Remote host closed the connection]
_whitelogger has joined #zig
_whitelogger has joined #zig
clktmr has quit [Ping timeout: 252 seconds]
dingenskirchen has quit [Read error: Connection reset by peer]
dingenskirchen1 has joined #zig
dingenskirchen1 is now known as dingenskirchen
wilsonk has quit [Ping timeout: 240 seconds]
return0e_ has joined #zig
wilsonk has joined #zig
<dantix> why I cannot loop through `StructField`'s at runtime? Is it because it has strings and possibly other data memory for which is allocated during comptime, so it cannot be accessed at runtime?
ftxqxd has joined #zig
dingenskirchen has quit [Read error: Connection reset by peer]
dingenskirchen1 has joined #zig
dingenskirchen1 is now known as dingenskirchen
dantix has quit [Quit: Bye]
return0__ has joined #zig
return0e_ has quit [Ping timeout: 264 seconds]
<daurnimator> andrewrk: why is the fifo module not in the std docs?
marijnfs__ has quit [Quit: WeeChat 2.6]
dingenskirchen has quit [Remote host closed the connection]
dingenskirchen has joined #zig
ftxqxd has quit [Ping timeout: 250 seconds]
kenaryn has joined #zig
<mq32> is the "index" in builtin.StackTrace the "length" of the trace?
<kenaryn> Hi computer people. According to rumors, a certain pixelherodev would have written an interesting blog entry few days ago, does anyone know its URI (or URL if you do not know the difference) please? I would be happy to read it.
data-man has joined #zig
<kenaryn> Thank you dingenskirchen, now I'm a happy man.
data-man has quit [Ping timeout: 265 seconds]
<mq32> dingenskirchen, i really like your nick. it's like you cannot even forget it ^^
<dingenskirchen> :p
<kenaryn> Hey, MasterQ32, what does your 'Q' mean?
<mq32> *grin*
<mq32> mq32/MasterQ32 is my "old" nickname, new one is "xq" (with the same Q)
<mq32> it's just the first letter of my last name
<mq32> (and x is the first letter of my first name)
return0e_ has joined #zig
<kenaryn> I thought there was some kind of embedded joke inside.
<mq32> nah, it's just a part of my real name
<kenaryn> Because Q is the phonetic equivalent for 'ass' in french.
<kenaryn> Allright :)
<mq32> haha, good to know!
return0__ has quit [Ping timeout: 276 seconds]
dimenus has joined #zig
kenaryn has left #zig ["Bye computer people!"]
dimenus has quit [Quit: Leaving]
dimenus has joined #zig
dingenskirchen has quit [Read error: Connection reset by peer]
dingenskirchen1 has joined #zig
dingenskirchen1 is now known as dingenskirchen
<companion_cube> and 'bit' of the french equivalent for 'cock' 🤷
<companion_cube> (you can imagine the meaning of 'q-bit'…)
<mq32> quantum bit? :D
<fengb> Dickbutt?
<mq32> huh
<companion_cube> that's how it sounds
<mq32> anyone an idea why my objdump doesn't intermix source lines for std?
<bgiannan> companion_cube, fellow french ?
<companion_cube> oui :p
<bgiannan> excellent!
<bgiannan> french people finding each other by chuckling at the sound of 'bit'
<companion_cube> classic move
<mq32> oh.
<mq32> if you embed your debug info, you will lose your debug info with objdump
<mq32> huh. this is stupid *grin*
<mq32> i have two options: "it doesn't crash, but i have debug symbols" or "it does crash, but i don't have debug symbols"
<leeward> Right. What's a cubit?
<leeward> Sorry, that joke hasn't aged well.
<mq32> hmm
<mq32> this assertion got hit when walking the stack
<mq32> anyone an idea why?
return0e has quit [Read error: Connection reset by peer]
return0e has joined #zig
<mq32> andrewrk, can you help me there?
<euantor> I'm trying to make use of `RegOpenKeyExW` on Windows, but it looks like `HKEY` is defined as a pointer to a struct: https://github.com/ziglang/zig/blob/e839250c5156d438f76e7b08e7053e9087fae77c/lib/std/os/windows/bits.zig#L630 - according to Microsoft's docs, `HKEY` is `typedef HANDLE HKEY`so would it make sense to update that code to `pub const HKEY = HANDLE`?
<mq32> const HKEY = *@OpaqueType(); is probably the best way
<mq32> "Pointer to unknown type"
<euantor> I also need to define some pre-defined HKEYs such as `HKEY_LOCAL_MACHINE` to make life easy: https://docs.microsoft.com/en-gb/windows/win32/sysinfo/predefined-keys
<dimenus> is there a recommended casing style for various Zig names?
adam98 has joined #zig
adam98 is now known as adamkowalski
<mikdusan> borked that link. this one is better. https://ziglang.org/documentation/master/#Names
<dimenus> got it :)
adamkowalski has left #zig [#zig]
adam98 has joined #zig
adam98 is now known as adamkowalski
waleee-cl has joined #zig
<companion_cube> bgiannan: what brings you here, btw? :)
<leeward> This seems like either a bug or a missing feature to me: https://godbolt.org/z/MNEddV Any plans to fix it?
<leeward> Specifically, "error: switch must handle all possibilities"
<mq32> leeward: switch must handle all possibilities is a quite sane decision ;)
<leeward> Yes, but look at the code. It does.
<mq32> yes, *you* know that
<mq32> the compiler doesn't
<mq32> cast your result to u1 and it does
<leeward> The compiler can know that, too. It knows what "& 0x1" means.
<mq32> @intCast(u1, byte & 0x1)
<mikdusan> the _type_ for `bytes & 0x1` is still u8
<leeward> Sure, and that's fine for that example, but it doesn't work well when I'm masking bits that aren't contiguous.
dingenskirchen has quit [Ping timeout: 276 seconds]
<leeward> What I'd like to do is "bytes & 0x5" with 4 cases.
<leeward> I could shift the bits around into a u2, but it's ugly.
<mq32> mikdusan: do we have a proposal about implicit integer narrowing?
<fengb> The usual "fix" for that is else => unreachable
<leeward> Ah, right. I forgot about unreachable.
<mq32> would be cool to have implicit narrowing when you mask bits away
<fengb> That also gives you a helpful error in safe builds if it's not true
<leeward> I agree it would be cool.
<leeward> It's also a pretty minor feature, so I totally understand if it's not on the list.
kenaryn has joined #zig
dingenskirchen has joined #zig
adamkowalski has quit [Ping timeout: 268 seconds]
<kenaryn> I noticed an unconsistency with test-related output. When `std.debug.warn();` is called, the compiler print the old `Test [n/n] test "<my_test_name>..."` formula. Otherwise, this kind of feed-back information is silently skipped.
kenaryn has quit [Quit: WeeChat 2.3]
mla has joined #zig
Akuli has joined #zig
marijnfs has joined #zig
marijnfs_ has quit [Ping timeout: 252 seconds]
return0e_ has quit [Remote host closed the connection]
<andrewrk> awareness of smaller int range on remainder division and masking is planned and there is an open issue for it
lunamn has joined #zig
frmdstryr has joined #zig
<bgiannan> companion_cube, i'm rewriting my game in zig
<companion_cube> ah, legit
<companion_cube> livin' on the edge
<shakesoda> i've been debating doing the same, in some future version
blAckEn3d has joined #zig
<blAckEn3d> Hi. I'm trying to compile a basic X11 program with zig 0.5.0. Almost everything works OK, but I'm not quite sure how to pass a string to a C function. Here's the error message: alex@Binky:/tmp$ ~/Apps/zig-linux-x86_64-0.5.0+4530adbd3/zig build-exe hello.zig -lX11 -lXft -lc -I/usr/include/ -L/usr/lib/x86_64-linux-gnu/ -I/usr/include/freetype2/
<blAckEn3d> /tmp/hello.zig:43:59: error: expected type '[*c]const c_uint', found '[*]const u8'
<blAckEn3d> _ = X11.XftDrawString32(xft, &col, f, 10, 50, c"", msg.len);
<blAckEn3d> ^
<blAckEn3d> /tmp/hello.zig:43:59: note: pointer type child 'u8' cannot cast into pointer type child 'c_uint'
<blAckEn3d> _ = X11.XftDrawString32(xft, &col, f, 10, 50, c"", msg.len);
<blAckEn3d> ^
<blAckEn3d> /tmp/hello.zig:43:36: note: referenced here
<blAckEn3d> _ = X11.XftDrawString32(xft, &col, f, 10, 50, c"", msg.len);
<blAckEn3d> ^
<andrewrk> hi blAckEn3d. you're going to want to use a pastebin-like service to link to a code snippet here
<blAckEn3d> Hi andrewrk. Apologies for the spam. Will do
<andrewrk> that function looks like it is expecting something other than UTF-8
<shakesoda> you likely want XftDrawString8?
<shakesoda> isn't that the utf-32 variant, you're using?
<blAckEn3d> Ah, right. Let's see if that works
<blAckEn3d> That works, thanks :)
<shakesoda> it might actually have a specific variant for Utf8
<shakesoda> try XftDrawStringUtf8, also
<shakesoda> i can't quite make sense of the description of the functions, it sounds like it's always unicode so 8 and utf8 should be the same thing
blAckEn3d has quit [Ping timeout: 264 seconds]
Ichorio_ has joined #zig
dantix has joined #zig
doublex_ has quit [Ping timeout: 240 seconds]
doublex has joined #zig
lunamn has quit [Ping timeout: 268 seconds]
lunamn has joined #zig
ftxqxd has joined #zig
kllr_sbstn has joined #zig
<leeward> Is there a way to trap runtime bounds checks so I can verify that they're working in a test?
<leeward> I don't want to verify that the bounds checks themselves work, but I do want to verify the bounds themselves. I suppose I could expectEqual(thing, array.len)
<leeward> There must be a way to do this. What am I missing?
<leeward> That is, make an array initializer in a constructor method of a struct.
<kllr_sbstn> leeward, like this? https://godbolt.org/z/wtDH3T
<leeward> kllr_sbstn: Not exactly. I want it initialized.
<leeward> I suppose I could do `= [1] { 0 } ** n` instead of `undefined`.
<leeward> But I don't need the size to be configurable.
<leeward> I just want to specify the length once.
<kllr_sbstn> i guess you could do this https://godbolt.org/z/FvFQxu
<leeward> Oh, huh.
<leeward> Yeah, that works. Thanks.
<leeward> I wonder if it's a bug though. The struct bit in the big long document is a bit light on details.
ftxqxd has quit [Ping timeout: 240 seconds]
Akuli has quit [Quit: Leaving]
<leeward> 21
<leeward> whoopsie
ftxqxd has joined #zig
<ftxqxd> Hello! I'm trying to build Zig from source for the first time, but am getting a bunch of clang errors about '<var> may be used uninitialized in this function' when running `make zig`
<andrewrk> ftxqxd, what version of clang
<ftxqxd> Looking at the source lines causing the errors, none of the variables seem to actually be uninitialized, so I'm very confused
<ftxqxd> 9.0.0
wink_ has quit [K-Lined]
<andrewrk> is that the same compiler that built the llvm & clang libraries that zig will link against?
<ftxqxd> It should be
<ftxqxd> If I remove -Werror from the CMakeLists.txt it compiles fine
<ftxqxd> (For context, I'm using the NixOS packages llvmPackages_9.clang-unwrapped and llvmPackages_9.llvm to compile)
<waleee-cl> ftxqxd: define an overlay instead then?
<ftxqxd> There's also an unused-result warning/error on src/os.cpp:85, which looks legit
<ftxqxd> Sorry, src/os.cpp:856
jjido has joined #zig
<marijnfs> did you build llvm yourself?
<ftxqxd> No, taken straight from the package manager
<ftxqxd> Might be the issue, haven't figured out what version of clang it was built with
<waleee-cl> oh, didn't notice the llvmPackages (<-- glaring missing version number)
<ftxqxd> Yeah, I think it defaults to 7
<ftxqxd> I think I tried that and it didn't work
<waleee-cl> which channel are you using? nixos-unstable should have 9 I think
<ftxqxd> I'm using nixos-unstable but llvmPackages is still llvmPackages_7
<ftxqxd> But my default.nix uses llvmPackages_9 so it's not a problem
<ftxqxd> Is clang known to occasionally output bogus maybe-uninitialized warnings?
<andrewrk> oh, ftxqxd nixos puts a bunch of weird flags. you need this thing I have in my env file
<andrewrk> here's my nix-shell file: https://clbin.com/8pTjj
<andrewrk> the hardeningDisable thing is I'm guessing the culprit
<ftxqxd> andrewrk: Aha! Thank you, trying it now
<ftxqxd> andrewrk: Great, that seemed to fix it
<ftxqxd> Thanks
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<andrewrk> ftxqxd, yeah that drove me nuts until I figured it out (notice who filed that issue and the date)
<THFKA4> i ran into the -Werror thing last week, i think cmake -DCMAKE_BUILD_TYPE=Release .. was my workaround
<andrewrk> `@as` landed in master branch. godspeed
<kllr_sbstn> a cast operator?
<andrewrk> `T(y)` is now `@as(T, y)`. `x(y)` is always a function call now.
<shakesoda> is there a specific reason there are @builtins for much of the std.math stuff
<shakesoda> i.e. are they convenience aliases, or actually different
<frmdstryr> Is std.net.TcpServer finalized? It looks like the TcpServer.accept returns a file but tosses the address
<shakesoda> andrewrk: thanks, makes sense
<shakesoda> the dupes just seem like mysterious clutter without the background knowledge there
<andrewrk> frmdstryr, it's a brand new API, not stable yet. that's something that needs to be added
<andrewrk> shakesoda, what dupes?
<shakesoda> andrewrk: std.math.sin -> @sin etc
<andrewrk> ah
jjido has joined #zig
<frmdstryr> Thanks. Does zig have a pair/tuple?
<kllr_sbstn> @andrewrk, wow, that's a big pr. better check if my code still compiles :)
<scientes> cool