ChanServ changed the topic of #zig to: zig programming language | ziglang.org | be excellent to each other | channel logs: https://irclog.whitequark.org/zig/
arBmind1 has joined #zig
arBmind has quit [Ping timeout: 248 seconds]
tyler569 has joined #zig
<GitHub94> [zig] MasonRemaley opened pull request #628: Implements translation for the prefix not operator (master...translate-c-prefix-not) https://git.io/vbfrr
arBmind1 has quit [Ping timeout: 248 seconds]
cenomla has quit [Quit: cenomla]
arBmind has joined #zig
<GitHub163> [zig] andrewrk pushed 5 new commits to master: https://git.io/vbfFp
<GitHub163> zig/master 04472f5 dimenus: Added support for exporting of C field expressions
<GitHub163> zig/master 57049b9 Ryan Saunderson: Resolving merge w/ upstream master
<GitHub163> zig/master f537c51 Andrew Kelley: Merge branch 'c-field-expr' of https://github.com/dimenus/zig into dimenus-c-field-expr
<GitHub48> [zig] andrewrk closed pull request #627: Added support for exporting of C field expressions (master...c-field-expr) https://git.io/vbv1x
arBmind has quit [Quit: Leaving.]
arBmind has joined #zig
dimenus has joined #zig
dimenus is now known as Guest21195
Guest21195 has quit [Killed (card.freenode.net (Nickname regained by services))]
dimenus has joined #zig
<dimenus> andrewrk, thanks for knocking that out last night. I can call GL macros as expected now
<andrewrk> dimenus, great!
<dimenus> how how do you initialize an array of unknown size?
<andrewrk> an array has a compile-time known size, if the size is only known at runtime, then you want a slice
<andrewrk> can you give me more context?
<dimenus> i was having a dunce moment, just alloc the array
<dimenus> i'm creating a ring buffer for an input queue and i have a second array to keep track of what slots are being used
<dimenus> and i was trying to figure out how to initialize the array to false, but it looks like the allocator does that for you.
<andrewrk> dimenus, the bytes are undefined
<andrewrk> if you want to initialize them, use mem.set
<andrewrk> hm I didn't document this, I'll do it
<dimenus> here's the scenario: https://pastebin.com/raw/0Ncrtz5t
<dimenus> i want to initialize items to a specific value
<andrewrk> dimenus, https://clbin.com/xiP5p
<dimenus> ah duh
<dimenus> lol
<andrewrk> we're going to add labeled blocks, labeled loops, labeled break, labeled continue, labeled return (from a block), and remove goto
cenomla has joined #zig
jjido has joined #zig
<jjido> Hello
<andrewrk> hi jjido
<jjido> What are the capabilities of zig's goto? Is it limited to 256 local labels like gcc?
<andrewrk> the only limitation is that you cannot jump over variable declarations or defer statements
<andrewrk> however there is an accepted proposal to do the following:
<andrewrk> add labeled blocks, labeled loops, labeled break, labeled continue, labeled return (from a block), and remove goto
<andrewrk> anything you can do with goto, you can do with the above features
<andrewrk> if you have a counter example, that would be most welcome
<jjido> Well I can still use older version of zig if that happens
<jjido> Don't know if it is a good counter example
<andrewrk> jjido, you are of course welcome to do that, however if you do it implies that you view the older version as better somehow, and I would find it valuable to understand why
<jjido> I am looking for a target to compile to
<andrewrk> I see
<andrewrk> so you want something like a basic b lock
<jjido> And assembly looks like a too high hurdle for me
<jjido> Llvm has no usable goto as well
<jjido> My language is continuation based
<andrewrk> have you looked at LLVM's coroutine support?
<jjido> I did briefly. Not exactly what I am after
<andrewrk> I think you can elegantly represent continuations with labeled return
<jjido> Yes labeled block looks perfect
<andrewrk> ok good
<andrewrk> but status quo is we have labels and goto
<andrewrk> jjido, I always welcome another zig user, but in the interest of actually helping you solve your problem, if you're writing a language you probably want to target LLVM and not zig
<jjido> I will do it the way I like. The goto probably makes zig a better target
<jjido> With llvm I need to use trampolining which I consider a big waste
<jjido> It uses a switch underneath
<andrewrk> can you elaborate?
<jjido> With limitations on the number of labels
<andrewrk> it sounds like you're talking about `switch`, not `br`
<jjido> Switch (label) case a: x; break ; case b
<andrewrk> are you talking about LLVM or your language?
<jjido> Yes I am saying llvm br is implemented in terms of switch
<andrewrk> I don't know where you're getting this idea from
<andrewrk> but zig's goto is just using llvm's `br`
<jjido> OK it changed in llvm 2.7
<jjido> I should have looked earlier
<jjido> 7 years ago... ah.
<andrewrk> goodness
<andrewrk> there have, uh, been quite a few improvements since then
jjido has quit [Ping timeout: 260 seconds]
jjido has joined #zig
<andrewrk> 72235 files changed, 11879380 insertions(+), 1140561 deletions(-)
<dtzWill> haha
cenomla has quit [Ping timeout: 248 seconds]
<dimenus> andrewrk, found a bug that triggers an llvm assert
<dimenus> #631
<andrewrk> dimenus, good find
<andrewrk> I think this should be a reasonably straightforward fix
<dimenus> it works fine on the stack
<dimenus> and with a native type
<dimenus> i should have tried it with a struct
cenomla has joined #zig
<dimenus> @sizeOf on []u8 always returns 16 rather than the actual size
<dimenus> if it's [4]u8 it returns the correct size
<andrewrk> that behavior is intended
<andrewrk> @sizeOf is how many bytes it takes to store a value
<andrewrk> you're looking for the `len` property
<andrewrk> some_slice.len
<dimenus> triggered the same assert with this: debug.warn("size: {}\n", usize(@sizeOf(@typeOf(enum_array[0]))));
<dimenus> yeah that only fails when the memory is on the heap
arBmind has quit [Quit: Leaving.]
arBmind has joined #zig
cenomla has quit [Quit: cenomla]
arBmind has quit [Quit: Leaving.]
jjido has quit [Read error: No route to host]