ChanServ changed the topic of #zig to: zig programming language | ziglang.org | be excellent to each other | channel logs: https://irclog.whitequark.org/zig/
commander has quit [Ping timeout: 252 seconds]
commander has joined #zig
mnoronha has quit [Ping timeout: 272 seconds]
mnoronha has joined #zig
mnoronha has quit [Ping timeout: 240 seconds]
reductum has joined #zig
reductum has quit [Client Quit]
mnoronha has joined #zig
mnoronha has quit [Ping timeout: 252 seconds]
<scientes>
why can't i do an assignment inside an if() ?
<scientes>
andrewrk, yeah the static zig isn't working either, it can build the executables but they crash http://paste.debian.net/1043767/
<scientes>
there must be something differn't about my environment
<andrewrk>
scientes, you can: if (blk: {assignment = whatever; break :blk true;}) {...}
<andrewrk>
that looks pretty ugly though, I probably wouldn't do it
<andrewrk>
very strange about executables crashing. I would like to understand why this is happening
<scientes>
me too
<scientes>
oh, that wasn't llvm-7 related, I was overflowing the stack
<scientes>
so the static build works
very-mediocre has joined #zig
unique_id has quit [Remote host closed the connection]
qazo has quit [Quit: No Ping reply in 180 seconds.]
qazo has joined #zig
qazo has quit [Quit: No Ping reply in 180 seconds.]
qazo has joined #zig
qazo has quit [Quit: No Ping reply in 180 seconds.]
qazo has joined #zig
qazo has quit [Client Quit]
qazo has joined #zig
qazo has quit [Quit: No Ping reply in 180 seconds.]
Ichorio has joined #zig
qazo has joined #zig
qazo has quit [Quit: No Ping reply in 180 seconds.]
qazo has joined #zig
qazo has quit [Quit: No Ping reply in 180 seconds.]
qazo has joined #zig
qazo has quit [Quit: No Ping reply in 180 seconds.]
qazo has joined #zig
qazo has quit [Quit: No Ping reply in 180 seconds.]
qazo has joined #zig
Jenz has joined #zig
<Jenz>
Does it matter whether I have my main function return void or !void ?
qazo has quit [Quit: No Ping reply in 180 seconds.]
qazo has joined #zig
Jenz has quit [Ping timeout: 252 seconds]
<very-mediocre>
Jenz that's a loaded question
<very-mediocre>
It should be !void for compiler safety if it has the potential to throw an error
<very-mediocre>
Many things don't "matter" in the output and are compiler safety features
qazo has quit [Quit: No Ping reply in 180 seconds.]
qazo has joined #zig
Jenz has joined #zig
<Jenz>
Thanks very-mediocre
qazo has quit [Quit: No Ping reply in 180 seconds.]
<very-mediocre>
Just to be clear, you're best off trying to use `void` by default
<very-mediocre>
but if you have anything in the function body that could return an error, the compiler would then force you to change to !void
qazo has joined #zig
<very-mediocre>
!void is shorthand for Error!void
<very-mediocre>
which is a union type, indicating the function can return void or error
<Jenz>
Yeah thanks, I (think I) get it
Jenz has quit [Quit: Lost terminal]
Jenz has joined #zig
qazo has quit [Read error: Connection reset by peer]
qazo has joined #zig
georgewhite has joined #zig
georgewhite has quit [Client Quit]
qazo has quit [Read error: Connection reset by peer]
qazo has joined #zig
very-mediocre has quit [Ping timeout: 256 seconds]
qazo has quit [Read error: Connection reset by peer]
Jenz has quit [Ping timeout: 245 seconds]
qazo has joined #zig
porky11 has joined #zig
qazo has quit [Read error: Connection reset by peer]
Jenz has joined #zig
qazo has joined #zig
qazo has quit [Read error: Connection reset by peer]
qazo has joined #zig
qazo has quit [Read error: Connection reset by peer]
qazo has joined #zig
qazo_ has joined #zig
qazo has quit [Read error: Connection reset by peer]
qazo_ has quit [Read error: Connection reset by peer]
<Jenz>
Why is the global allocator in std.debug ?
qazo has joined #zig
return0e_ has joined #zig
<Jenz>
Or, is that a stupid question?
<andrewrk>
Jenz, what's nice about !void is that in debug mode you'll get an error return trace if you return an error. the trace will show all the places the error was returned from a function
<andrewrk>
Jenz, that's a great question. it's there because it is not a general purpose allocatored - it's a statically allocated 100KB block of bytes, and you can never free anything
<andrewrk>
in other words, it's handy for quick tests and debugging, but otherwise it is not the correct allocator choice for your software
<Jenz>
Aha! Then everything makes sense, thanks again andrewrk!
<Jenz>
I was incorrect in assuming it was *the* global allocator then, but where would I find a production allocator?
<andrewrk>
you would find it in a future version of zig :)
<Jenz>
"production" allocator as in not "debug" one
<Jenz>
Oh, haha very well :D
<andrewrk>
we have no general purpose allocator currently. one alternative is to link against libc and use std.heap.c_allocator
<andrewrk>
depending on the requirements of your software, an arena allocator may be appropriate
<andrewrk>
and we do have one of those
<Jenz>
Either way, the debug one is what I need
<andrewrk>
the debug one is just a std.heap.FixedBufferAllocator. you can make your own as big as you want