ChanServ changed the topic of #zig to: zig programming language | ziglang.org | be excellent to each other | channel logs: https://irclog.whitequark.org/zig/
MajorLag has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<GitHub103>
zig/master 05ecb49 Andrew Kelley: README: https links
<GitHub103>
zig/master 4c3aa09 Andrew Kelley: self hosted compiler: remove unused flag
davr0s has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
davr0s has joined #zig
Ichorio has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
davr0s has joined #zig
Skilfingr has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
jjido has joined #zig
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
SimonNa has quit [Quit: Leaving]
ofelas has quit [Quit: shutdown -h now]
ofelas has joined #zig
<Skilfingr>
andrewrk, when we reach unreachable code in a function then panic is called. Must the function then still return the correct stack pointer address in ESP? Is the RET instruction executed at this point?
<Skilfingr>
I want to initialize many function pointers (with different parameters) with the same dummy function. All stdcall. The dummy function will only do a warn() and "panic".
davr0s has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
davr0s has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
davr0s has joined #zig
darithorn has joined #zig
darithorn has quit [Client Quit]
darithorn has joined #zig
darithorn has quit [Remote host closed the connection]
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
darithorn has joined #zig
<andrewrk>
Skilfingr, panic has the return type "noreturn" which meants control flow shall not return from it
<andrewrk>
there's no coming back from panic
<andrewrk>
let's figure out the best way to solve your problem
<andrewrk>
do you have some (non working is fine) code to demonstrate what you're trying to do?
<andrewrk>
if you're asking if you can clobber ESP in your panic implementation, that's fine
<Skilfingr>
thinking about gl loader
<Skilfingr>
Before loading the functions, i want to init the functions pointers with a dummy function. But i do not want to create 1000 dummy functions
<andrewrk>
and the dummy function will load the real function and replace itself?
<Skilfingr>
no, the dummy will just print a warning if called and then call panic
<andrewrk>
why not initialize the functions to null?
<Skilfingr>
i thought null pointers in zig are not a thing
<andrewrk>
you can opt in to having them, but then you have to explicitly handle the possibility of null
<atk>
at every call site?
<andrewrk>
e.g. you would call with (??fn_ptr)(arg1, arg2). And you would get a panic if the fn_ptr was null
<atk>
It might be a bit of a performance PITA to have a null check at every call site, especially in any potential hot paths.
<andrewrk>
in release mode the null check is not present
<atk>
hmm
<andrewrk>
you can also disable the check in debug mode
<andrewrk>
the dummy function idea is fine too. It should be ok to @ptrCast your dummy function (which just calls @panic) to the gl function in question
<Skilfingr>
?? seems better then if (x) |y| for each call. In normal zig code i might use this. Not sure for a wrapper. Now i have two options. thanks.
<andrewrk>
?? communicates exactly what you intend: in debug mode you want to panic; in release-fast mode you want to assume it will never be null
<GitHub113>
zig/master abcd418 Andrew Kelley: std.zig.parse cleanup
Sahnvour has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
davr0s has joined #zig
isd has joined #zig
isd has quit [Ping timeout: 240 seconds]
_0joshuaolson1 has joined #zig
isd has joined #zig
<_0joshuaolson1>
Is there an analogue of @import("builtin") for the compiling platform? builtin.environ is just an enum, so I don't know how an arbitrary comptime function could get, for example, the compiling platform's endianness.
_0joshuaolson1_ has joined #zig
_0joshuaolson1 has quit [Ping timeout: 260 seconds]
<_0joshuaolson1_>
I'm porting a biginteger library, and even with this information endianess will complicate supporting comptime...
<andrewrk>
_0joshuaolson1_, why do you need to know the compiling platform?
<andrewrk>
comptime function execution emulates the target platform
<_0joshuaolson1_>
For suppoting initializing/computing a bigint at compile-time (like as a constant) that can then be used at runtime. Thanks, is the target emulation thing in the documentation?
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<_0joshuaolson1_>
And how far does the emulation go? All Zig-defined behavior?
<andrewrk>
it's probably good to mention it explicitly, but it's necessary for something to have the same behavior whether run at compile-time or runtime
<andrewrk>
if you can observe a difference in comptime code and runtime code, it's a zig compiler bug
<_0joshuaolson1_>
Then there's no complication after all! Awesome
_0joshuaolson1_ has quit [Quit: Page closed]
darithorn has quit [Quit: Leaving]
davr0s has joined #zig
_0joshuaolson1 has joined #zig
<_0joshuaolson1>
Wait, in theory what endianness would comptime code see if it received an array pointer from a C call?
<_0joshuaolson1>
I don't care why one would ever do that, just curious about the emulation's design.
<andrewrk>
you can't make a C call at compile time
<_0joshuaolson1>
No network requests either?
<andrewrk>
correct - no syscalls
<andrewrk>
but we do have @embedFile
_0joshuaolson1 has quit [Quit: Page closed]
Ichorio has quit [Ping timeout: 250 seconds]
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Skilfingr has quit [Quit: Page closed]
Sahnvour has quit [Quit: Page closed]
alexnask_ has joined #zig
alexnask has quit [Ping timeout: 264 seconds]
strangeqargo has joined #zig
<strangeqargo>
:D
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]