Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix nob's program name on windows #87

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Notxsomeone
Copy link

Although executable on windows end with .exe they can be called without them. This makes argv[0] different from the actual name of the program (nob.exe) and causes MoveFileEx to fail.

nob.c Outdated Show resolved Hide resolved
@Subhranil-Maity
Copy link

As of my understanding you are never breaking out or the loop. Are You?

@Notxsomeone
Copy link
Author

As of my understanding you are never breaking out or the loop. Are You?

while(0) technique is used everywhere and it only runs once. I don't know what are you talking about.

@Subhranil-Maity
Copy link

My apologies I overlooked while(0).
But is using a single interactional loop advantageous by any change.Just a question from my side

@Notxsomeone
Copy link
Author

My apologies I overlooked while(0). But is using a single interactional loop advantageous by any change.Just a question from my side

It makes the entire macro act like a statement, meaning you have to put a semicolon at the end plus it has its own scope so no conflicts if you call it multiple times.
If I really wanted to be pedantic it would have been nice to surround argv with parentheses so expressions get evaluated, but that's a very unusual use case for argv (you are supposed to just pass it as it is) so whatever. Classic C macros and its shenanigans.

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.

3 participants