Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@KorryKatti
Copy link
Contributor

Added a note about Windows behavior when using const stdout = std.io.getStdOut().writer() outside functions. On Windows, this expression is evaluated at compile-time, which may cause issues. The solution is to place it inside a function to avoid compile-time evaluation.

@pedropark99
Copy link
Owner

Uhmm, interesting, do you know if this issue is documented somewhere? Maybe in a GitHub issue? Or, in a specific section of the official Zig docs?

@KorryKatti
Copy link
Contributor Author

Uhmm, interesting, do you know if this issue is documented somewhere? Maybe in a GitHub issue? Or, in a specific section of the official Zig docs?

my only knowledge of zig is from your book really 😅but i noticed this problem while coding and confirmed with 2-3 more people who i know.

@KorryKatti
Copy link
Contributor Author

when the stdout is outside the pub fn function:

error:

image

code:

image

when stdout is inside the function :

output :

image

code:

image

@KorryKatti
Copy link
Contributor Author

it is probably a windows only problem

@pedropark99
Copy link
Owner

Found two issues that document this specific requirement on Windows:

@pedropark99 pedropark99 merged commit afe06f4 into pedropark99:main Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants