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/
VFEXrt has quit [Quit: Connection closed]
<oats> is there a way I can tell zig not to optimize away a variable?
<oats> eg, if it appears unused to the compiler
<g-w1> std.mem.doNotOptimizeAway ;)
<oats> lol that's an amazing solution
<oats> I love it
<g-w1> what does rm even do?
<g-w1> is it cross-platform?
<oats> rm?
<g-w1> : [val] "rm" (val)
<oats> huh, I've got no idea what's going on there
<oats> I think it's "putting" `val` into the `rm` register
<oats> still don't understand it though
hiljusti has quit [Ping timeout: 240 seconds]
<kiedtl> How does one cast an integer to an integer type of a lower width while truncating bits that don't fit? (something like @intCast that never panics)
<g-w1> @truncate
B767B has quit [Remote host closed the connection]
<cr1901_modern> Is there a bitvector library for zig (didn't find one through GH search, doesn't mean it doesn't exist)? I want to do base-2 modular arithmetic.
<cr1901_modern> I can create my own []u1 matrices if I must (without the packing optimization)
<daurnimator> cr1901_modern: std.PackedArray ? or std.EnumSet ?
<kiedtl> cr1901_modern: You could use a C library without too much of a hassle... I guess?
klltkr has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
xentec_ has quit [Quit: memento mori]
xentec has joined #zig
xentec has quit [Remote host closed the connection]
xentec has joined #zig
zenkuro has quit [Ping timeout: 240 seconds]
xackus_ has joined #zig
xackus has quit [Ping timeout: 252 seconds]
notzmv has quit [Ping timeout: 260 seconds]
<cr1901_modern> ack I'll take a look
notzmv has joined #zig
<kiedtl> What's the ziggiest way to iterate over an integer range?
VFEXrt has joined #zig
<daurnimator> Use a while loop?
earnestly has quit [Ping timeout: 268 seconds]
<andrewrk> using zig's general purpose allocator leak checker + rr-project to get a debugger to print information at the callsite of the leaked memory allocation: https://clbin.com/6t88D
<daurnimator> oh cool; rr finally support amd: > Experimental support for AMD Zen-based CPUs was merged on September 18, 2020.
terinjokes has quit [Quit: ZNC 1.8.1 - https://znc.in]
terinjokes has joined #zig
xackus_ has quit [Ping timeout: 252 seconds]
<kiedtl> daurnimator: so 'var foo = 0; while (foo < max) : (foo += 1) {}'? I was hoping that zig had something like `for (0..1) |index| {}' that scoped the index var
notzmv has quit [Ping timeout: 246 seconds]
waleee-cl has quit [Quit: Connection closed for inactivity]
cole-h has quit [Ping timeout: 240 seconds]
VFEXrt has quit [Quit: Connection closed]
notzmv has joined #zig
[wtf] has joined #zig
riba has joined #zig
[wtf] has quit [Quit: [wtf]]
pretty_dumm_guy has joined #zig
earnestly has joined #zig
notzmv has quit [Ping timeout: 240 seconds]
riba has quit [Ping timeout: 260 seconds]
<daurnimator> kiedtl: correct. many people have said the same thing
cow-orker has joined #zig
Guest96063 has joined #zig
wootehfoot has joined #zig
gpanders has quit [Quit: ZNC - https://znc.in]
gpanders has joined #zig
xackus_ has joined #zig
Guest96063 has quit [Remote host closed the connection]
notzmv- has joined #zig
jokoon has joined #zig
xackus__ has joined #zig
<mikdusan> daurnimator: would you have some time to grab linux `lscpu` and /proc/cpuinfo output from some of those arm servers?
<mikdusan> pr could use the samples: https://github.com/ziglang/zig/pull/8671
xackus_ has quit [Ping timeout: 246 seconds]
ifreund has quit [Quit: WeeChat 3.1]
ifreund has joined #zig
ifreund has left #zig [#zig]
<daurnimator> mikdusan: okay. which do you want?
ifreund has joined #zig
ifreund has left #zig [#zig]
ifreund has joined #zig
<daurnimator> looks like you have Cavium already
<mikdusan> yeah I guess falkor would do it
notzmv- has quit [Remote host closed the connection]
notzmv has joined #zig
zenkuro has joined #zig
jmercan has joined #zig
B767B has joined #zig
B767B has quit [Remote host closed the connection]
B767B has joined #zig
zenkuro has quit [Ping timeout: 240 seconds]
jmercan has quit [Ping timeout: 252 seconds]
zenkuro has joined #zig
klltkr has joined #zig
<v0idifyy> kiedtl, you can wrap the whole thing in a { block }
jokoon has quit [Quit: Leaving]
v0idifyy has quit [Quit: ZNC 1.8.2 - https://znc.in]
dongcarl has quit [Ping timeout: 252 seconds]
pretty_dumm_guy has quit [Quit: WeeChat 3.2-dev]
cole-h has joined #zig
B767B has quit [Remote host closed the connection]
B767B has joined #zig
<daurnimator> mikdusan: I'm not sure if falkor is an option I have?
<mikdusan> daurnimator: no probs. I can do a tmp pr for ci-script to grab it. Thanks for looking!
<daurnimator> mikdusan: current CPU list: http://sprunge.us/eFo0lC
B767B has quit [Remote host closed the connection]
<marler8997> is this expected, when I call an async function twice in a row, each call gets a new @frame() pointer, but when I call it multiple times in a loop, each call returns the same @frame pointer...?
<marler8997> there's something really screwy with the async implementation at the moment
<fengb> That sounds correct. Loops reuse the memory space because the stack is invalidated
<marler8997> the stack is invalidated after every function call regardless of whether you call it in a loop
<marler8997> I don't understand the lifetime of the memory pointed to by @frame()
<fengb> @frame() is just a pointer to where you dump the frame
<marler8997> but it's not a pointer to the stack is it?
<fengb> When you do “var foo = async bar()”, that sets the frame onto the current stack
<fengb> Depends on where you stick the async call
<marler8997> can't be
<marler8997> oh wait
<marler8997> you're saying it reserved space on the stack while the async call is alive
<marler8997> so if you returned from your current function where you called async, then the async frame itself would also be invalidated correct?
<fengb> No, it reserves space when the stack is alive
<fengb> After the block returns, that async frame is use after free
<marler8997> "the block"?
<fengb> The block where you assigned the async
<marler8997> ah
ifreund has left #zig ["WeeChat 3.1"]
ifreund has joined #zig
<fengb> There’s no hidden allocation happening. You need to manually hoist the frame outside of the loop
SimonNa has quit [Quit: Leaving]
<marler8997> does the documentation say this? I was reading it and don't remember it saying that
SimonNa has joined #zig
iamanoob has joined #zig
iamanoob has quit [Read error: Connection reset by peer]
<fengb> Hmm I don’t see anything
<marler8997> yeah, but I think you're right, with that new nuget of understanding I'm able to solve this guys question on reddit now
B767B has joined #zig
jmercan has joined #zig
<marler8997> fengb here's my answer thanks to your help: https://www.reddit.com/r/Zig/comments/n3407d/need_help_writing_a_custom_event_loop/
<g-w1> wow i just tried out rr debugger and it is soooooo powerful! reverse-cont is a killer feature
<g-w1> thanks for reminding me about it andrewrk
<marler8997> I feel like maybe async would be easier to understand if we explicitly required the frame memory to be given at the call size
<g-w1> on the downside, it seems its not trivial to implement the redundant comptime feature in stage1 :(
<marler8997> var frame: @Frame(foo) = undefined; _ = async frame foo(...);
<g-w1> this generates a lot of false positives: https://clbin.com/j6oCL
<ifreund> g-w1: is it really worth implementing in stage1?
<g-w1> yes, someone on discord got confused again today, and i think its a pretty nice feature
jmercan has quit [Quit: leaving]
<g-w1> it caught a bunch of stuff in the stdlib already
<g-w1> im not gonna pursue it if i have to rewrite a bunch of stage1, but if its easy, ill do it
<ifreund> I'd be very surprised if it was easy
<g-w1> i think the issue is that the top level scope is a comptime scope in stage1 so everything is automatically a comptime scope
<g-w1> i dont think its *that* hard
<g-w1> then again, every time i have tried to fix stage1 before, i broke something else...
<ifreund> yeah, many things that should be trivial in stage1 aren't
<ifreund> and fixing that isn't really worth it when stage2 should self host in the next year at the current pace
<g-w1> i think theres a trade off between making life better for others and driving yourself crazy
<ifreund> I mean I won't tell you how to spend your time, but there are lots of other things to work on that won't get thrown out when we self host :P
pretty_dumm_guy has joined #zig
<g-w1> ok, I think this is still kinda trivial, but i wont spend that much more time on it
<g-w1> ok, got it down to a few cases! i think these are all valid cases where comptime can be eliminated because the return type of the functions is comptime (either comptime_int or type) https://clbin.com/WvRTE
<g-w1> is this correct?
ifreund has quit [Ping timeout: 240 seconds]
<g-w1> when I remove those 2 errors, stage1 can compile!
SimonNa has quit [Remote host closed the connection]
SimonNa has joined #zig
<marler8997> are async frames pinned in memory?
<mq32> yes
<mq32> they are one reason for the pinned struct proposal
xackus__ has quit [Ping timeout: 240 seconds]
deb303 has quit [Ping timeout: 268 seconds]
B767B has quit [Remote host closed the connection]
deb303 has joined #zig
bitmapper has joined #zig
ifreund has joined #zig
ifreund has quit [Remote host closed the connection]
ifreund has joined #zig
riba has joined #zig
pretty_dumm_guy has quit [Quit: WeeChat 3.2-dev]
jmercan has joined #zig
Akuli has joined #zig
mikdusan has quit [Read error: Connection reset by peer]
<andrewrk> g-w1, yeah combined with hardware memory address watch points, it's pretty incredible
Akuli has quit [Quit: Leaving]
mokafolio has quit [Ping timeout: 276 seconds]
Akuli has joined #zig
mikdusan has joined #zig
waleee-cl has joined #zig
notzmv has quit [Ping timeout: 260 seconds]
mokafolio has joined #zig
riba has quit [Ping timeout: 260 seconds]
jmercan has left #zig [#zig]
<oats> trying out zls for the first time
<oats> this level of autocompletion and stuff is *so nice* for embedded dev
<g-w1> interesting, does clangd not work?
pretty_dumm_guy has joined #zig
Akuli has quit [Quit: Leaving]
pingiun has joined #zig
notzmv has joined #zig
dongcarl has joined #zig
jeang3nie has joined #zig
<g-w1> 😱 more test runner support! andrewrk do you plan to get test runner going before merging the branch?
<andrewrk> I think so :)
<g-w1> thats so cool
<g-w1> so you will have to get at least primitive arrays working?
<andrewrk> I think arrays will be pretty straightforward actually
<g-w1> those will open up lots more zir instructions to work on :)
<cr1901_modern> The build section of ziglearn is really good. Props to the ppl who wrote it
<cr1901_modern> I feel a lot less lost after reading it
DarkPlutonium has joined #zig
DarkUranium has quit [Remote host closed the connection]
DarkPlutonium is now known as DarkUranium
daex has quit [Ping timeout: 265 seconds]
daex_ has joined #zig
adsr has quit [Read error: Connection reset by peer]
<andrewrk> that would be Sobeston
<cr1901_modern> >Types in Zig are values of the type type.
<cr1901_modern> What does this mean? That e.g. f32, u32, etc is a subtype of type?
<cr1901_modern> And how is "type" related to "comptime_int", "comptime_float", and "anytype" (if at all?)
<cr1901_modern> Gonna try not to ask qs too much, but I couldn't resist this one
<g-w1> const T: type = u32;
<g-w1> const T: type = type; ;)
<cr1901_modern> I haven't seen the "type =" syntax yet
<cr1901_modern> So Idk what those do, other than "type = type" _feels_ like it shouldn't work
<g-w1> its not syntax, its just manually saying the type of T is `type`
<g-w1> just like `var i: u32 = 1;`
<cr1901_modern> Does const impl comptime?
<cr1901_modern> imply*
<g-w1> no, you can have runtime consts
<cr1901_modern> B/c the example I was looking at had "comptime T: type"
<g-w1> thats saying that the paramater must be comptime
<g-w1> types only exist as a compitme concept