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/
ur5us_ has quit [Ping timeout: 264 seconds]
<g-w1> deleteTreeAbsolute
<g-w1> std.fs.!!
<g-w1> or deleteTree
<yZ5vlALg86lP> ah.
<yZ5vlALg86lP> not os, fs!
<yZ5vlALg86lP> thx
xackus_ has joined #zig
<GrooveStomp> Can I install 0.6.0 via snap?
ur5us_ has joined #zig
develonepi3 has quit [Quit: Leaving]
earnestly has quit [Ping timeout: 256 seconds]
<teratorn> can someone try to reproduce this hanging "bench" test? http://0x0.st/inVC.zig
<teratorn> if you reduce the for-loop count to 1000 it works fine
<teratorn> am i exploding an arraylist? and maybe the hash algo is putting them in the same bucket?
<teratorn> windbg says in in a Wyhash function
<frmdstryr> time per 10,000: 230.5134ns
<frmdstryr> It is doing a ton of allocations
radgeRayden has quit [Ping timeout: 272 seconds]
radgeRayden has joined #zig
<teratorn> frmdstryr, well that would be expected
<teratorn> but why the performance fall off?
<teratorn> the hashmap and arraylists dont appear to be exploding
<teratorn> and it doesnt peg cpu or mem usage
wootehfoot has quit [Read error: Connection reset by peer]
<frmdstryr> on linux it's not hanging and pegging one core at 100%
<frmdstryr> memory goes up to about ~400MB
<frmdstryr> teratorn: Did you try running in release-safe? A profiler shows its in zig_assert
<teratorn> no
<frmdstryr> it runs really quick with release safe
a92 has joined #zig
<g-w1> andrewrk: sorry to ping you about this but i spent a very long time trying to figure this out and no one else seems to know: in type.zig, how would I extract fields from a type.Type.Payload.ErrorSet? only the value.Value.Payload.ErrorSet has fields. I tried to do this but it didn't work: var a_fields = @fieldParentPtr(TypedValue, "ty", &a).val.cast(Value.Payload.ErrorSet).?.fields; (this is in the context of
<g-w1> trying to impliment type equality checking for error sets/error unions) ~type.zig:229. thanks so much
cole-h has quit [Ping timeout: 264 seconds]
<andrewrk> uhh no @fieldParentPtr here, not sure where that's coming from.
<g-w1> I thought that `a` was a type that had a corresponding val that shared a TypedValue.
<g-w1> Since only the val has fields, how else would you find the fields?
earnestly has joined #zig
<andrewrk> you're talking about error { these, fields } right?
<g-w1> yes, I am trying to compare 2 error sets, but to compare them I need to know the fields, right?
<andrewrk> those fields are part of the error set type, so you'll get them through the Type, not through a Value
<g-w1> the Type.Payload.ErrorSet only has decl, should I look for it there? in the typed_value of the decl?
<andrewrk> for me to answer this question is the same thing as writing the code - I don't know until I try it
<g-w1> ok :) ill try there
CodeSpelunker has joined #zig
<teratorn> whats the diff between [*]u8 and []u8 and how do I get the former from the latter?
<g-w1> thanks for being a rubber duck. in analyzeInstErrorSet -> createAnonymousDecl there is an anon struct creation of a TypedValue. the anonymous struct is what tripped me up. im so happy that i figured this out
<g-w1> teratorn: [*]u8 is basically a c poiinter but you are telling zig that it has multiple items. I would reccomend the zig showtime talk by loris about pointers. he goes in-depth on how to convert all the types and what they are. its very good
<g-w1> for reference, this is the code that got it: a.cast(Payload.ErrorSet).?.decl.typed_value.most_recent.typed_value.val.cast(Value.Payload.ErrorSet).?.fields;
<teratorn> g-w1, got a link?
<teratorn> how do you go about allocating a u8 buffer and returning a pointer to it?
<g-w1> allocate it using an allocator.create([how_big_buf]u8) and then return what you get from the allocator (it is already a pointer)
<teratorn> i was using mem.alloc(u8, size(
<teratorn> .\amp.zig:239:42: error: unable to evaluate constant expression
<teratorn> ^
<teratorn> var buf = try self.alloc.create([length]u8);
<teratorn> i dont understand why allocator.alloc(u8, size) doesn't produce the type you can return from an fn?
<teratorn> frmdstryr, ^
<frmdstryr> can you share the code? alloc returns a slice
<travv0> that should work fine, what problem are you having?
<teratorn> u cant return a slice though right?
<teratorn> the compile error should tell you what is wrong
<travv0> you can return a slice
<travv0> a slice is just a pointer plus a length
decentpenguin has quit [Quit: ZNC crashed or something]
<travv0> use alloc() instead of create() and change the return type to return a slice instead of an unknown-length pointer
<frmdstryr> yes ^^
a92 has quit [Quit: My presence will now cease]
<teratorn> ok excellent
<teratorn> im thinking its a slice like rust which is a borrow
<teratorn> i guess it is fundamentally different than that?
<companion_cube> slices in rust are exactly the same, but they generally have a borrowed lifetime
<companion_cube> (they're pointer+length)
<teratorn> is there a btreemap implementation in zig somewhere? i want a map with deterministic insertion order
<fengb> No btree yet
<teratorn> yeah the memory management model semantics is what i meant
<teratorn> hmm i wonder how hard it would be to port one
<teratorn> from C or Rust or something
CodeSpelunker has quit [Quit: CodeSpelunker]
<companion_cube> there's one in rust's stdlib
kristoff_it has quit [Ping timeout: 272 seconds]
<teratorn> ~2700 SLOC :/
mmohammadi9812 has joined #zig
<companion_cube> quite big indeed
<companion_cube> but there's a entry API and all the iteration stuff
<teratorn> ideally I would generate struts for each type i want to decode off the wire
<teratorn> but exposing that via C and WASM in a language-agnostic way could be problematic
decentpenguin has joined #zig
xackus has joined #zig
xackus_ has quit [Ping timeout: 240 seconds]
earnestly has quit [Ping timeout: 260 seconds]
drazan has quit [Remote host closed the connection]
drazan has joined #zig
a_chou has joined #zig
data-man has joined #zig
data-man has quit [Client Quit]
jjsullivan1 has quit [Remote host closed the connection]
jjsullivan1 has joined #zig
a_chou has quit [Remote host closed the connection]
a_chou has joined #zig
a_chou has quit [Remote host closed the connection]
ur5us_ has quit [Ping timeout: 264 seconds]
lucid_0x80 has joined #zig
jmiven has quit [Quit: bye]
jmiven has joined #zig
lucid_0x80 has quit [Ping timeout: 258 seconds]
lucid_0x80 has joined #zig
marnix has joined #zig
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
zipp has quit [Remote host closed the connection]
_whitelogger has joined #zig
<marler8997__> is there some way to tell at comptime if we are compiling with tests enabled?
xackus_ has joined #zig
xackus has quit [Ping timeout: 260 seconds]
<daurnimator> marler8997__: yes, look in builtin
<marler8997__> thanks @import("builtin").is_test seems to work
lltt has quit [Remote host closed the connection]
lltt has joined #zig
waleee-cl has quit [Quit: Connection closed for inactivity]
xackus_ has quit [Read error: Connection reset by peer]
xackus has joined #zig
sord937 has joined #zig
cole-h has joined #zig
<daurnimator> marler8997__: never import builtin directly; use `std.builtin`
Kingsquee has quit []
xackus has quit [Ping timeout: 256 seconds]
Astolfo` has joined #zig
Astolfo` has quit [Client Quit]
Astolfo` has joined #zig
Astolfo` has quit [Client Quit]
b_jonas has quit [Quit: leaving]
ur5us_ has joined #zig
sord937 has quit [Remote host closed the connection]
sord937 has joined #zig
ask6155 is now known as help
help is now known as Guest60637
Guest60637 is now known as ask6155
earnestly has joined #zig
dumenci has joined #zig
hnOsmium0001 has quit [Quit: Connection closed for inactivity]
lucid_0x80 has quit [Ping timeout: 256 seconds]
jjsullivan has quit [Ping timeout: 264 seconds]
ur5us_ has quit [Ping timeout: 260 seconds]
squeek502 has joined #zig
<teratorn> what's the canonical way to compare two memory buffers ([]u8) ?
<teratorn> for a unit test
<scientes> mem.eql
<scientes> but style questions are generally a waste of time
tane has joined #zig
<teratorn> how about printing binary data with escapes?
<scientes> somewhere in fmt
<scientes> not sure if fmt has nidce documentation, but that would be nice
<ikskuh> teratorn: you want to print a byte buffer as escaped ASCII or as hexadecimal?
<teratorn> either way
<ikskuh> {x} or {X} for hexadecimal
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
mmohammadi9812 has quit [Ping timeout: 264 seconds]
mmohammadi9812 has joined #zig
kristoff_it has joined #zig
ifreund has quit [Read error: Connection reset by peer]
ifreund 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]
marnix has joined #zig
cole-h has quit [Ping timeout: 260 seconds]
Kena has joined #zig
<Kena> Hello living on the edge computional people. Does someone know why bool type is 1 byte-aligned instead of u1? There are 7 bits lost each type a boolean expression is evaluated, and therefore increase the software's latency.
<Kena> *computational
mmohammadi9812 has quit [Ping timeout: 256 seconds]
<hch> does `zig cc` have sth similar to `(clang|gcc) -dumpmachine` ?
<ugla> Kena: a byte is often the smallest addressable unit of memory
<ifreund> also usize is probably the fastest type to opreate on as it fits exactly in a register or whatever
<Kena> Allright but I thought Zig was able to compete against C for low-level software. I think ignoring reduced instruction set architecture target would be a mistake
<ifreund> really though this is microoptimization, you won't know anything for sure without benchmarking
lucid_0x80 has joined #zig
<ifreund> Kena: bools are u1 when in packed structs by the way
<Kena> How could you replace a bool by a usize?
dumenci has quit [Ping timeout: 260 seconds]
<ifreund> in general
<ifreund> let the optimizer worry about that
mmohammadi9812 has joined #zig
dumenci has joined #zig
<ugla> Kena: a standard C bool is the same size, for what it's worth
<ifreund> infact
<ifreund> urgh, in fact that's probably why zigs bool is one byte
<ifreund> otherwise we would need c_bool
lltt has quit [Ping timeout: 260 seconds]
marnix has quit [Ping timeout: 256 seconds]
lucid_0x80 has quit [Ping timeout: 264 seconds]
marnix has joined #zig
<Sahnvour> byte-sized bools also do not require additional bit shifting to be used with typical cpu instructions
marnix has quit [Ping timeout: 260 seconds]
CommunistWolf has quit [Quit: No Ping reply in 180 seconds.]
CommunistWolf has joined #zig
<g-w1> is there a way to compare 2 array hash maps, or subtract one from another, without cloning anything
nrdmn has quit [Quit: The Lounge - https://thelounge.chat]
nrdmn has joined #zig
<teratorn> .\amp.zig:384:5: error: variable of type 'comptime_int' must be const or comptime
<teratorn> var i = 0;
<teratorn> ^
<teratorn> .\amp.zig:385:12: note: referenced here
<teratorn> while (i < len) : (i += 1)
<teratorn> ^
<teratorn> whyyy
<g-w1> var i: u32
<dutchie> probably usize tbh
<dutchie> but yeah
<dutchie> top zig papercut
<teratorn> why does it pick a bad type?
<alexnask[m]> Integer literals are of type `comptime_int` because they can be arbitrarily large
<ikskuh> teratorn: which type should it pick?
<teratorn> i dunno something that works in a for loop
<Kena> Please what is the Zig equivalent for CHAR _BIT in C? Is it u8?
<ikskuh> Kena: it does not exist
b_jonas has joined #zig
<ikskuh> @bitSizeOf(c_char) would be the explicit equivalent i think?
<ikskuh> oh, c_char doesn't exist :O
<ikskuh> zig assumes that a byte is always the smallest adressable unit
<ikskuh> thus, @sizeOf(u8) == 1 and @bitSizeOf(u8) == 8
<Kena> Thank you buddy you're kind.
<fengb> c_char might be added due to C ambiguities :P
<ikskuh> c_char == u6
<ikskuh> :D
tane has quit [Quit: Leaving]
omglasers2 has joined #zig
marnix has joined #zig
Kena has quit [Quit: Ping timeout (120 seconds)]
waleee-cl has joined #zig
donniewest has joined #zig
dumenci has quit [Remote host closed the connection]
zippoh has joined #zig
Kena has joined #zig
tane has joined #zig
<Kena> Please How can I get the size of the size of a declared variable? `@sizeOf()` `@sizeOf(TypeOf())``@bitSizeOf()` and @typeInfo().Int.bits return each an error who message is beyond me.
<ikskuh> @sizeOf(@TypeOf(xyz))
<ikskuh> is the size in bytes for a var named "xyz"
<Kena> error: expected type 'std.builtin'.TypeInfo', found 'i8'
<ikskuh> huh
<ikskuh> can you show me the full source?
<g-w1> does error {Thing} coerce to anyerror?
<ikskuh> yes, it does
<g-w1> but with @as(anyerror, error{Thing}) doesn't work. im implimenting more error stuff in stage2, should I make it castable?
lucid_0x80 has joined #zig
<ikskuh> error{Thing} is a type
<ikskuh> error.Thing is the error of type error{Thing}
<ikskuh> sorry
<g-w1> ok
<g-w1> and error.Thing can coerce to anyerror?
<alexnask[m]> error{Thing} is a type
<fengb> Do you mean error.Thing?
<alexnask[m]> yeah
<g-w1> yes i think
<g-w1> so error{Thing} can coerce to type anyerror?
<g-w1> or error.Thing can coerce to anyerror. all these types that are also values are confusing me
Snetry has joined #zig
dddddd has quit [Ping timeout: 240 seconds]
<marler8997__> daurnimator, why "never import builtin directly; use `std.builtin`" ?
<ifreund> iirc importing directly is deprecated?
<travv0> whoops i always import it directly
<marler8997__> I'm not seeing where it has been deprecated, and the zig docs still use it
skuzzymiglet has joined #zig
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
Kena has quit [Remote host closed the connection]
lucid_0x80 is now known as suskun
CodeSpelunker has joined #zig
xackus has joined #zig
<dutchie> one day i'll remember which commands want -OReleaseSafe and which ones want -Drelease-safe
<dutchie> probably by then the CLI will have been tidied up so they are all consistent
factormystic has quit [Quit: The Lounge - https://thelounge.chat]
GrooveStomp has quit [Ping timeout: 246 seconds]
factormystic has joined #zig
<alexnask[m]> -D is a way of passing options to build scripts
<alexnask[m]> So -D<some_mode> is always a build.zig thing
hnOsmium0001 has joined #zig
lltt has joined #zig
squeek502 has quit [Ping timeout: 272 seconds]
<tsujp> Congrats on 0.7.0! I'm a bit late to the party but none the less splendid work
<tsujp> Hey I have a Q and please direct me to the right place if this is too general or likely to be missed: I want to contribute to Zig but right now contributions directly to the language are not yet feasible (still learning Zig so I am a beginner/intermediate there); is the Zig website something that is in scope for a change etc?
<tsujp> I am a fullstack dev and web designer so I'd be keen to contribute to some FOSS, of course free
<g-w1> right now loris is working on the website on twitch, you could ask him https://www.twitch.tv/kristoff_it
skuzzymiglet has quit [Ping timeout: 256 seconds]
dddddd has joined #zig
jjsullivan has joined #zig
wilsonk_ has quit [Read error: Connection reset by peer]
wilsonk_ has joined #zig
suskun has quit [Ping timeout: 272 seconds]
CodeSpelunker has quit [Quit: CodeSpelunker]
xackus has quit [Remote host closed the connection]
xackus has joined #zig
wootehfoot has joined #zig
<dutchie> i made a start on updating the zig version in nixpkgs, but it gives an AccessDenied error when it tries to run the tests. i've tried setting XDG_CACHE_HOME in various places but it hasn't helped. any ideas? https://github.com/jshholland/nixpkgs/commit/18d77f9c26a1a97ffcd938d1365cc3afc9a7c859
<dutchie> logs: https://0x0.st/invJ.txt
wootehfoot has quit [Quit: Leaving]
skuzzymiglet has joined #zig
wootehfoot has joined #zig
cole-h has joined #zig
jjsullivan has quit [Ping timeout: 244 seconds]
cole-h has quit [Quit: Goodbye]
cole-h has joined #zig
moinstar has quit [Quit: Leaving.]
gpanders has quit [Quit: ZNC - https://znc.in]
gpanders has joined #zig
skuzzymiglet has quit [Read error: Connection reset by peer]
yeti has quit [Remote host closed the connection]
yeti has joined #zig
ur5us_ has joined #zig
kristoff_it1 has joined #zig
kristoff_it has quit [Ping timeout: 258 seconds]
<yZ5vlALg86lP> specifically why is there a Dir.deleteTree and also a deleteTreeAbsolute, why this distinction? why not have one fn that deletestree irrespective of the path being absolute or relative?
<yZ5vlALg86lP> s/specifically//
skuzzymiglet has joined #zig
kristoff_it has joined #zig
<g-w1> deleteTreeAbsolute is just a wrapper. it doesn't take a dir as an arg
<travv0> the non-absolute path functions will also take an absolute path
<g-w1> it is basically equalalent to std.fs.cwd().deleteTree
<g-w1> read the source
<ifreund> it asserts that the path is absolute no?
<g-w1> yes
<travv0> the absolute path one does yeah
gpanders has quit [Quit: ZNC - https://znc.in]
gpanders has joined #zig
kristoff_it1 has quit [Ping timeout: 258 seconds]
layneson has joined #zig
layneson has quit [Client Quit]
<yZ5vlALg86lP> i actually read the source. and it confused me, that's why i asked here
<yZ5vlALg86lP> the confusing part is why does the non absolute version need the Dir as a first parameter, i mean, why expose this to the dev? why not handle this transparently?
<g-w1> it is so that they can pass whatever dir they want, it may not always be cwd(). cwd().openDir("thing").deleteTree("other")
<yZ5vlALg86lP> there could be a wrapper that checks the path being absolute, and if not instantiates a std.fs.cwd() instead
<g-w1> what if you dont want to use cwd
<yZ5vlALg86lP> then i concat the path with the prefix i want instead of cwd
<yZ5vlALg86lP> paths are strings, even if relative
<g-w1> i feel like that would 1. use allocation 2. be more complex than just chaining a bunch of openDir
<yZ5vlALg86lP> how frequent is the case that the path is neither absolute nor relative to cwd?
<yZ5vlALg86lP> i feel that this case is quite rare
<g-w1> im pretty sure this is because of the way openat works at the system level: it needs a fd pub fn openat(dirfd: i32, path: [*:0]const u8, flags: u32, mode: mode_t) usize {
riba has joined #zig
<g-w1> std/os/linux.zig:568
<travv0> if you tend to mostly want paths relative to the cwd it seems fs.cwd().function() isn't a lot to type, and then it still allows people that need things relative to other directories to do that using the same function
frmdstryr has quit [Ping timeout: 264 seconds]
gpanders has quit [Quit: ZNC - https://znc.in]
<yZ5vlALg86lP> oki, i guess this being posix openat related is a reason i can live with.
kristoff_it has quit [Read error: Connection reset by peer]
gpanders has joined #zig
kristoff_it has joined #zig
gpanders has quit [Client Quit]
gpanders has joined #zig
<danyspin97_> is there something similar to rust std::result::Result?
<danyspin97_> or someway to pass the error message instead of the error code
<travv0> i think there's a proposal open for a way to pass information along with an error
<danyspin97_> I see
<danyspin97_> because logging inside a library function doesn't seems correct
<danyspin97_> but also returning a "Permission Denied" error seems meaningless. What was it trying to open?
gpanders has quit [Quit: ZNC - https://znc.in]
<dominikh> Allow returning a value with an error - https://github.com/ziglang/zig/issues/2647
gpanders has joined #zig
<travv0> i think the current workaround is to pass some sort of error context argument that you populate if there's an error, i haven't personally done anything like that though so i could be wrong
gpanders has quit [Client Quit]
gpanders has joined #zig
<danyspin97_> travv0: thanks, I'll use that
gpanders has quit [Client Quit]
<danyspin97_> dominikh: I see, still heavily discussed
<danyspin97_> I guess we'll see it in 0.9.0
gpanders has joined #zig
kristoff_it has quit [Ping timeout: 260 seconds]
<travv0> it's unfortunately not even accepted yet but i believe it's a really popular proposal. i certainly would like to see it happen
<ifreund> danyspin97_: logging inside a library function is an intended use case for std.log
marnix has quit [Ping timeout: 272 seconds]
<ifreund> just put all of your library's logging in a custom scope
<danyspin97_> ifreund: what about a module with some functions?
<danyspin97_> I have 3 binaries that reuse the same modules
<danyspin97_> I don't want to expose the module name to the user (just the error msg should suffice)
marnix has joined #zig
<ifreund> sure, do whatever makes sense
<ifreund> there's no hard and fast rules because 1. zig isn't mature and 2. hard rules aren't flexible
marnix has quit [Ping timeout: 256 seconds]
<g-w1> to go back to my question from earlier, should @typeOf(error.Thing) == error {Thing, Other}. I do not think this is the case, but if not, what operation could i do to @typeOf(error.Thing) (error {Thing}) to turn it into error { Thing, Other }? (thinking about this from a compiler type coerction perspective). should I just merge it with the other set to create a new set? i cant find a cast about this in
<g-w1> ir.cpp~15241 (where all the casts are) so I assume that @typeOf(error.Thing) == error {Thing, Other}? although this is not true when trying it out. could someone point me in the right direction of how the semantics of this should work please?
<g-w1> or should it be an exception that if an error is returned from a function that @typeOf(error.TheErorr) is in the return error set (talking about defined error return sets) it will automatically coerce to the larger set, but only in this example?
drazan has quit [Remote host closed the connection]
dddddd has quit [*.net *.split]
ask6155 has quit [*.net *.split]
neptunepink has quit [*.net *.split]
swills has quit [*.net *.split]
crimson_penguin has quit [*.net *.split]
scientes has quit [*.net *.split]
s-ol has quit [*.net *.split]
via has quit [*.net *.split]
signop has quit [*.net *.split]
Ristovski has quit [*.net *.split]
nickster has quit [*.net *.split]
m6w6 has quit [*.net *.split]
terinjokes has quit [*.net *.split]
benaiah has quit [*.net *.split]
ask6155 has joined #zig
neptunepink has joined #zig
crimson_penguin has joined #zig
swills has joined #zig
s-ol has joined #zig
scientes has joined #zig
via has joined #zig
Ristovski has joined #zig
nickster has joined #zig
m6w6 has joined #zig
terinjokes has joined #zig
benaiah has joined #zig
signop has joined #zig
dddddd has joined #zig
swills has quit [Max SendQ exceeded]
swills has joined #zig
drazan has joined #zig
cole-h has quit [*.net *.split]
wootehfoot has quit [*.net *.split]
lltt has quit [*.net *.split]
zippoh has quit [*.net *.split]
LanceThePants has quit [*.net *.split]
haliucinas has quit [*.net *.split]
Kuraitou has quit [*.net *.split]
casaca has quit [*.net *.split]
lunamn has quit [*.net *.split]
linuxgemini has quit [*.net *.split]
hspak has quit [*.net *.split]
marler8997__ has quit [*.net *.split]
nyaayaya has quit [*.net *.split]
racoon has quit [*.net *.split]
lroy64[m] has quit [*.net *.split]
[RMS] has quit [*.net *.split]
Sergeeeek[m] has quit [*.net *.split]
josias has quit [*.net *.split]
xmn11 has quit [*.net *.split]
mla has quit [*.net *.split]
bodie_ has quit [*.net *.split]
teratorn has quit [*.net *.split]
doublej41 has quit [*.net *.split]
lanodan has quit [*.net *.split]
dom96 has quit [Ping timeout: 266 seconds]
nrdmn has quit [*.net *.split]
Cloudef has quit [*.net *.split]
shurane has quit [*.net *.split]
wjlroe has quit [*.net *.split]
PC980177 has quit [*.net *.split]
allan0 has quit [*.net *.split]
karchnu has quit [*.net *.split]
letoram has quit [*.net *.split]
dominikh has quit [*.net *.split]
cow-orker has quit [*.net *.split]
V has quit [*.net *.split]
shodan45 has quit [*.net *.split]
lroy64[m] has joined #zig
teratorn has joined #zig
bodie_ has joined #zig
doublej41 has joined #zig
Sergeeeek[m] has joined #zig
lanodan has joined #zig
[RMS] has joined #zig
mla has joined #zig
josias has joined #zig
xmn11 has joined #zig
karchnu has joined #zig
Cloudef has joined #zig
shurane has joined #zig
dominikh has joined #zig
allan0 has joined #zig
V has joined #zig
PC980177 has joined #zig
letoram has joined #zig
shodan45 has joined #zig
cow-orker has joined #zig
nrdmn has joined #zig
wjlroe has joined #zig
teratorn has quit [Max SendQ exceeded]
lanodan has quit [Max SendQ exceeded]
[RMS] has quit [Max SendQ exceeded]
teratorn_ has joined #zig
[RMS] has joined #zig
klltkr has joined #zig
swills has quit [*.net *.split]
xackus has quit [*.net *.split]
yeti has quit [*.net *.split]
tsujp has quit [*.net *.split]
amk has quit [*.net *.split]
blueberrypie has quit [*.net *.split]
lemmi has quit [*.net *.split]
Tharro has quit [*.net *.split]
lltt has joined #zig
LanceThePants has joined #zig
zippoh has joined #zig
haliucinas has joined #zig
cole-h has joined #zig
wootehfoot has joined #zig
Kuraitou has joined #zig
casaca has joined #zig
lunamn has joined #zig
marler8997__ has joined #zig
nyaayaya has joined #zig
linuxgemini has joined #zig
hspak has joined #zig
racoon has joined #zig
Seich has quit [*.net *.split]
ncon has quit [*.net *.split]
drazan has quit [*.net *.split]
ifreund has quit [*.net *.split]
demizer has quit [*.net *.split]
tomku has quit [*.net *.split]
companion_cube has quit [*.net *.split]
nullheroes has quit [*.net *.split]
Thalheim has quit [*.net *.split]
kandinski has quit [*.net *.split]
sjums has quit [*.net *.split]
hspak has quit [Max SendQ exceeded]
znowflak3[m] has quit [*.net *.split]
Nypsie[m] has quit [*.net *.split]
BaroqueLarouche has quit [*.net *.split]
Dominic[m] has quit [*.net *.split]
dom96 has joined #zig
dom96 has joined #zig
dom96 has quit [Changing host]
hspak has joined #zig
ifreund has joined #zig
drazan has joined #zig
tomku has joined #zig
demizer has joined #zig
companion_cube has joined #zig
nullheroes has joined #zig
Thalheim has joined #zig
kandinski has joined #zig
sjums has joined #zig
swills has joined #zig
yeti has joined #zig
xackus has joined #zig
Seich has joined #zig
amk has joined #zig
ncon has joined #zig
lemmi has joined #zig
Tharro has joined #zig
blueberrypie has joined #zig
swills has quit [Max SendQ exceeded]
BaroqueLarouche has joined #zig
Dominic[m] has joined #zig
znowflak3[m] has joined #zig
Nypsie[m] has joined #zig
nullheroes has quit [Max SendQ exceeded]
tsujp has joined #zig
sord937 has quit [*.net *.split]
lanodan has joined #zig
Nypsie[m] has quit [Ping timeout: 240 seconds]
nullheroes has joined #zig
shurane has quit [Ping timeout: 272 seconds]
ugla has quit [Ping timeout: 246 seconds]
protheory8-new-m has quit [Ping timeout: 246 seconds]
novaskell has quit [Ping timeout: 260 seconds]
hnOsmium0001 has quit [Ping timeout: 244 seconds]
Snektron has quit [Ping timeout: 240 seconds]
znowflak3[m] has quit [Ping timeout: 240 seconds]
BaroqueLarouche has quit [Ping timeout: 240 seconds]
Dominic[m] has quit [Ping timeout: 240 seconds]
bfredl has quit [Ping timeout: 246 seconds]
alexnask[m] has quit [Ping timeout: 246 seconds]
fengb has quit [Ping timeout: 246 seconds]
aterius has quit [Ping timeout: 246 seconds]
gpanders[m] has quit [Ping timeout: 244 seconds]
ifreund_ has quit [Ping timeout: 244 seconds]
sergeeeek[m]1 has quit [Ping timeout: 268 seconds]
lroy64[m] has quit [Ping timeout: 260 seconds]
Sergeeeek[m] has quit [Ping timeout: 260 seconds]
josias has quit [Ping timeout: 260 seconds]
wootehfoot has quit [Read error: Connection reset by peer]
swills has joined #zig
sord937 has joined #zig
donniewest has quit [*.net *.split]
blackbeard420 has quit [*.net *.split]
Guest85216 has quit [*.net *.split]
eddyb[legacy] has quit [*.net *.split]
SimonNa has quit [*.net *.split]
notpiika has quit [*.net *.split]
chivay has quit [*.net *.split]
hch has quit [*.net *.split]
Piraty has quit [*.net *.split]
dmiller has quit [*.net *.split]
shachaf has quit [*.net *.split]
tane has quit [*.net *.split]
techtirade has quit [*.net *.split]
st4ll1 has quit [*.net *.split]
nore has quit [*.net *.split]
edr has quit [*.net *.split]
jicksaw has quit [*.net *.split]
braket has quit [*.net *.split]
freshmaker666 has quit [*.net *.split]
albertito has quit [*.net *.split]
lucus16 has quit [*.net *.split]
johnLate has quit [*.net *.split]
SimonNa has joined #zig
donniewest has joined #zig
Piraty has joined #zig
eddyb[legacy] has joined #zig
hch has joined #zig
blackbeard420 has joined #zig
notpiika has joined #zig
Guest85216 has joined #zig
chivay has joined #zig
shachaf has joined #zig
dmiller has joined #zig
srgpqt[m] has quit [Ping timeout: 246 seconds]
riba has quit [Ping timeout: 246 seconds]
lanodan has quit [*.net *.split]
jmiven has quit [*.net *.split]
radgeRayden has quit [*.net *.split]
mokafolio has quit [*.net *.split]
gonz_ has quit [*.net *.split]
utzig has quit [*.net *.split]
jzelinskie has quit [*.net *.split]
r0bby has quit [*.net *.split]
ovf has quit [*.net *.split]
Biolunar has quit [*.net *.split]
Wolf480pl has quit [*.net *.split]
mkchan has quit [*.net *.split]
yZ5vlALg86lP has quit [*.net *.split]
ikskuh has quit [*.net *.split]
mmx870 has quit [*.net *.split]
rom1504 has quit [*.net *.split]
torque has quit [*.net *.split]
cmrs has quit [*.net *.split]
earl has quit [*.net *.split]
eddyb[legacy] has quit [Ping timeout: 256 seconds]
techtirade has joined #zig
tane has joined #zig
nore has joined #zig
st4ll1 has joined #zig
edr has joined #zig
freshmaker666 has joined #zig
jicksaw has joined #zig
braket has joined #zig
lucus16 has joined #zig
albertito has joined #zig
johnLate has joined #zig
lanodan has joined #zig
radgeRayden has joined #zig
gonz_ has joined #zig
mokafolio has joined #zig
jzelinskie has joined #zig
utzig has joined #zig
ovf has joined #zig
r0bby has joined #zig
Biolunar has joined #zig
yZ5vlALg86lP has joined #zig
earl has joined #zig
mkchan has joined #zig
Wolf480pl has joined #zig
ikskuh has joined #zig
rom1504 has joined #zig
mmx870 has joined #zig
cmrs has joined #zig
torque has joined #zig
jmiven has joined #zig
hnOsmium0001 has joined #zig
ovf has quit [Ping timeout: 240 seconds]
earnestly has quit [*.net *.split]
dbohdan has quit [*.net *.split]
xentec has quit [*.net *.split]
danyspin97_ has quit [*.net *.split]
KoljaKube has quit [*.net *.split]
Nilium has quit [*.net *.split]
pjz has quit [*.net *.split]
jwmerrill has quit [*.net *.split]
[RMS] has quit [*.net *.split]
gpanders has quit [*.net *.split]
b_jonas has quit [*.net *.split]
decentpenguin has quit [*.net *.split]
osa1 has quit [*.net *.split]
gazler_ has quit [*.net *.split]
WilhelmVonWeiner has quit [*.net *.split]
tughi has quit [*.net *.split]
DarkUranium has quit [*.net *.split]
mschwaig has quit [*.net *.split]
leah2 has quit [*.net *.split]
ave_ has quit [*.net *.split]
wesleyac has quit [*.net *.split]
commander has quit [*.net *.split]
Amun_Ra has quit [*.net *.split]
oats has quit [*.net *.split]
AlbinoDrought has quit [*.net *.split]
andrewrk has quit [*.net *.split]
iwq has quit [*.net *.split]
pixelherodev has quit [*.net *.split]
so has quit [*.net *.split]
justin_smith has quit [*.net *.split]
diginet has quit [*.net *.split]
dkibi has quit [*.net *.split]
shurane has joined #zig
wesleyac has joined #zig
[RMS] has joined #zig
gpanders has joined #zig
osa1 has joined #zig
tughi has joined #zig
WilhelmVonWeiner has joined #zig
mschwaig has joined #zig
DarkUranium has joined #zig
ave_ has joined #zig
leah2 has joined #zig
commander has joined #zig
decentpenguin has joined #zig
b_jonas has joined #zig
gazler_ has joined #zig
Amun_Ra has joined #zig
AlbinoDrought has joined #zig
andrewrk has joined #zig
iwq has joined #zig
justin_smith has joined #zig
diginet has joined #zig
oats has joined #zig
dkibi has joined #zig
pixelherodev has joined #zig
so has joined #zig
dbohdan has joined #zig
xentec has joined #zig
earnestly has joined #zig
KoljaKube has joined #zig
jwmerrill has joined #zig
Nilium has joined #zig
danyspin97_ has joined #zig
pjz has joined #zig
Snetry has quit [*.net *.split]
omglasers2 has quit [*.net *.split]
mixi has quit [*.net *.split]
tcsc has quit [*.net *.split]
rzezeski has quit [*.net *.split]
mixi has joined #zig
omglasers2 has joined #zig
Snetry has joined #zig
tcsc has joined #zig
rzezeski has joined #zig
skuzzymiglet has quit [*.net *.split]
wilsonk_ has quit [*.net *.split]
factormystic has quit [*.net *.split]
mmohammadi9812 has quit [*.net *.split]
knebulae has quit [*.net *.split]
plakband has quit [*.net *.split]
Miaourt has quit [*.net *.split]
Techcable has quit [*.net *.split]
RoguePointer has quit [*.net *.split]
jahaja has quit [*.net *.split]
Stephie has quit [*.net *.split]
tdeo has quit [*.net *.split]
mgxm has quit [*.net *.split]
tines9 has quit [*.net *.split]
mht has quit [*.net *.split]
Cadey has quit [*.net *.split]
bens has quit [*.net *.split]
Ankhers has quit [*.net *.split]
waleee-cl has quit [*.net *.split]
euantorano has quit [*.net *.split]
dputtick has quit [*.net *.split]
lqd has quit [*.net *.split]
betawaffle has quit [*.net *.split]
Cynthia has quit [*.net *.split]
yrashk has quit [*.net *.split]
travv0 has quit [*.net *.split]
karrick has quit [*.net *.split]
guan has quit [*.net *.split]
kwilczynski has quit [*.net *.split]
Sahnvour has quit [*.net *.split]
denucat has quit [*.net *.split]
JoshAshby has quit [*.net *.split]
greaser|q_ has quit [*.net *.split]
daurnimator has quit [*.net *.split]
ggVGc has quit [*.net *.split]
THFKA4 has quit [*.net *.split]
ky0ko1 has quit [*.net *.split]
halbeno has quit [*.net *.split]
drvirgilio has quit [*.net *.split]
M-ou-se has quit [*.net *.split]
urluck has quit [*.net *.split]
skuzzymiglet has joined #zig
wilsonk_ has joined #zig
factormystic has joined #zig
mmohammadi9812 has joined #zig
knebulae has joined #zig
plakband has joined #zig
Stephie has joined #zig
Cadey has joined #zig
bens has joined #zig
RoguePointer has joined #zig
Techcable has joined #zig
jahaja has joined #zig
tines9 has joined #zig
tdeo has joined #zig
mht has joined #zig
Miaourt has joined #zig
Ankhers has joined #zig
mgxm has joined #zig
mmohammadi9812 has quit [Max SendQ exceeded]
klltkr has quit [*.net *.split]
dingenskirchen has quit [*.net *.split]
dongcarl has quit [*.net *.split]
ky0ko has quit [*.net *.split]
g-w1 has quit [*.net *.split]
lkurusa has quit [*.net *.split]
drewr has quit [*.net *.split]
meowray has quit [*.net *.split]
Ekho has quit [*.net *.split]
lohengrin has quit [*.net *.split]
euantorano has joined #zig
waleee-cl has joined #zig
lqd has joined #zig
dputtick has joined #zig
yrashk has joined #zig
Cynthia has joined #zig
travv0 has joined #zig
betawaffle has joined #zig
guan has joined #zig
karrick has joined #zig
Sahnvour has joined #zig
kwilczynski has joined #zig
JoshAshby has joined #zig
denucat has joined #zig
daurnimator has joined #zig
greaser|q_ has joined #zig
ggVGc has joined #zig
halbeno has joined #zig
THFKA4 has joined #zig
ky0ko1 has joined #zig
drvirgilio has joined #zig
M-ou-se has joined #zig
urluck has joined #zig
kwilczynski has quit [Max SendQ exceeded]
lkurusa has joined #zig
klltkr has joined #zig
dingenskirchen has joined #zig
dongcarl has joined #zig
g-w1 has joined #zig
ky0ko has joined #zig
drewr has joined #zig
meowray has joined #zig
Ekho has joined #zig
lohengrin has joined #zig
Ekho has quit [Max SendQ exceeded]
dongcarl has quit [Max SendQ exceeded]
r0bby has quit [Ping timeout: 271 seconds]
tcsc has quit [Ping timeout: 246 seconds]
hnOsmium0001 has quit [Ping timeout: 240 seconds]
eddyb[legacy] has joined #zig
dongcarl1 has joined #zig
betawaffle has quit [Ping timeout: 254 seconds]
yrashk has quit [Ping timeout: 254 seconds]
hnOsmium0001 has joined #zig
waleee-cl has quit [Ping timeout: 260 seconds]
so has quit [Max SendQ exceeded]
yrashk has joined #zig
Cynthia has quit [Ping timeout: 260 seconds]
xackus has quit [Ping timeout: 260 seconds]
tcsc has joined #zig
ovf has joined #zig
r0bby has joined #zig
waleee-cl has joined #zig
klltkr has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
kwilczynski_ has joined #zig
Ekho has joined #zig
Cynthia has joined #zig
so has joined #zig
ovf has quit [Excess Flood]
betawaffle has joined #zig
ovf has joined #zig
kwilczynski_ is now known as kwilczynski
sord937 has quit [Quit: sord937]
bfredl has joined #zig
alexnask[m] has joined #zig
Nypsie[m] has joined #zig
protheory8-new-m has joined #zig
fengb has joined #zig
ugla has joined #zig
sergeeeek[m]1 has joined #zig
tane has quit [Quit: Leaving]
novaskell has joined #zig
Sergeeeek[m] has joined #zig
lltt has quit [Remote host closed the connection]
lltt has joined #zig
srgpqt[m] has joined #zig
ifreund_ has joined #zig
frmdstryr has joined #zig
gpanders[m] has joined #zig
Dominic[m] has joined #zig
Snektron has joined #zig
lroy64[m] has joined #zig
BaroqueLarouche has joined #zig
znowflak3[m] has joined #zig
josias has joined #zig
aterius has joined #zig
xackus has joined #zig
<teratorn_> whats wrong with this syntax? stdout.print("here: {} {}", .{pair.key.len, pair.value.len}) catch |err|{};
<ifreund> what's the error you get?
<teratorn_> whats wrong with this syntax? stdout.print("here: {} {}", .{pair.key.len, pair.value.len}) catch |err|{};
<teratorn_> .\amp.zig:38:74: error: expected token '}', found 'catch'
<teratorn_> {stdout.print("here: {} {}", .{pair.key.len, pair.value.len}); } catch |err|{};
<teratorn_> nvm i got it dumb mistake
<ifreund> ok, well that's not the same code you pasted in the first message
<ifreund> cool :)
mmohammadi9812 has joined #zig
skuzzymiglet has quit [Ping timeout: 256 seconds]
riba has joined #zig
riba has quit [Ping timeout: 260 seconds]
<teratorn_> could anyone tell me why the last test case is printing len: <value> with a really huge corrupted number, when it is supposed to be stored to as an out variable, and be 23... ?
<ifreund> var buf: [*]u8 = @intToPtr([*]u8, 1);
<ifreund> that'd be why
donniewest has quit [Read error: Connection reset by peer]
<teratorn_> ifreund, how does that affect len?
<ifreund> teratorn_: that line is UB, what it does is undefined
zippoh has quit [Remote host closed the connection]
<ifreund> use a real buffer instead of just hoping that it's ok to write over whatever is at address 1
<ifreund> var buf:
<ifreund> var buf:[4096]u8 = undefined;
<teratorn_> its an out var
<teratorn_> it should be set to a real address later
<teratorn_> make sense?
<ifreund> oh well in that case use undefined to initialize it
<teratorn_> ifreund, ok i do it. still same issue though
<ifreund> I'm very confused why this function doesn't just return a slice
<teratorn_> it will be exported to C which informs the design significantly
<ifreund> well, you can't return an error union either in that case
<novaskell> teratorn_: try writing it for zig first and consider how to wrap it for C after you've got it working correctly. Also, avoid `[*]` everywhere that's not touching C directly as it should only live at the edge between the two
<ifreund> novaskell: you're thinking of [*c], [*] is totally fine to use in pure zig
<teratorn_> its virtually complete already so its not really worth having two API layers
<teratorn_> its a very simple protocol, and the api is straight forward
<ifreund> and [*c] is only for autogenerated bindings, if you're writing manual bindings you should figure out the correct zig pointer type
<teratorn_> but ill take that advise under advisement for the future
Kena has joined #zig
<teratorn_> ok, but the issue remains
<teratorn_> why cant i seem to assign to a usize out var?
omglasers2 has quit [Read error: Connection reset by peer]
<ifreund> try throwing a print statement the loop in the function you're testing
<teratorn_> maybe it overwriting the stack
<teratorn_> im assigning to a buffer... i think just the pointer but maybe not?
<novaskell> `[*]` given a length should be a slice `[]` inside as soon as practical/possible unless there's a specific reason to keep `[*]`
<Kena> Please can someone can tell me what's wrong? I'm trying to write my very first function in Zig and the error message doesn't help: https://zero.hurtig.ninja/?ba478c45a8d1b207#AOP200einbozH/KLnSbYgcIGL3465q3tglippgppzws=
<Kena> Made a mistake in the before-last comment, it's actually 253.
<ifreund> Kena: I'm confused by your function, shouldn't isEven just be `return x & 1 == 0`
<Kena> If the number is 8 bits it must >> to 7 bits, if it's 16 bits, it have to >> 15 bits, etc.
<teratorn_> well a simple test case does work, http://0x0.st/inxW.zig
<ifreund> why? you only need to look at the least significant bit
<Kena> Yes, you're right. That's what i'm trying to do.
<ifreund> x & 1 will equal 1 exactly when the least significant bit of x is 1
<Kena> Do you mean `& 1` shift right towards the lower bit value?
<ifreund> no, no shifting
<ifreund> & is a bitwise and
<Kena> yes I agree but the following number will represent a bit?
ur5us_ has quit [Ping timeout: 264 seconds]
<Kena> Because it's a comptime_int
<ifreund> it should coerce to whatever the type of x is
<Snektron> doesn't @bitSizeOf(@TypeOf(x)) yield the same as @typeInfo(u16).Int.bits?
<Kena> Allright ifreund thanks. Indeed, Snektron!
<Snektron> then bit_masking is always 1
<Snektron> and as a result the function returns true when x is either 1 or 0
<Kena> Allright, thanks for your help.
<Kena> fn isEven(x: u16) bool { return x & 1 == 0;} produces exactly the same error, I don't understand.
<ifreund> Kena: D is odd
<Kena> yes you're right I changed it to C to get the even number 252, but now the tests only fails when they check against binary notation.
<Kena> Can't we test binary number for parity?
<ifreund> also, please write this as x % 2 == 0, it's much more readable and llvm is smart enough to optimize it to whatever is fastest
<fengb> 0xFFFD = 253
<ifreund> Kena: your first number is 7 not 6
<ifreund> both are odd
<ifreund> as you see, the lsb is 1 for both of them, which is exactly what you are testing