Improve compile error when using std.io.getStdOutHandle
After noticing that there are >4 issues made by people thinking this is a bug I thought it might be useful to improve the compile error to avoid more redundant issues. I would have liked to open a proposal issue for this, but that's not possible as of now. It is, however not breaking any code that isn't already broken, so I decided to make a pr anyways.
Related: https://github.com/ziglang/zig/issues/19864 https://github.com/ziglang/zig/issues/17186 https://github.com/ziglang/zig/issues/6845 https://github.com/ziglang/zig/issues/14203
Wouldn't hurt to also add this for at least stderr.
Good call, I don't know why I didn't think of that
Done :+1:
Hi! Apologies for this: stdin is also affected. Up to you all if you'll add this.
I'll just note here that in general, anything put in global that calls windows.peb() and windows.teb() (code) are affected. But since most that I found for this are already Windows specific, I don't think we should add the notice for these.
I agree that the error shouldn't be returned by peb and teb, because this would also mean that the error message might have to be more generic, which would also make it less clear to the user if this is intended behavior or not. Additionally, this would not work for the current aarch64 workaround https://github.com/ziglang/zig/blob/master/lib/std/io.zig#L19 and cause more inconsistent behaveior from a user perspective. Let me know your thoughts on this!
No thanks, it's fine as-is. It also breaks something that works fine on non-Windows targets.
It also breaks something that works fine on non-Windows targets.
The errors are in Windows only branches.
I see. It's still fine as-is. @inComptime is not meant to be used this way.
However, there is documentation missing on this function.
You're right, I just checked the docs on @inComptime and it does say that it should be used primarily for e.g. performance improvements.
Should I just add the note about the functions not compiling on windows as a doc comment and open a new pr?