tsoding / musializer

Music Visualizer
MIT License
877 stars 92 forks source link

Fix nob's program name on windows #87

Open Notxsomeone opened 6 months ago

Notxsomeone commented 6 months ago

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.

Subhranil-Maity commented 6 months ago

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

Notxsomeone commented 6 months ago

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 commented 6 months ago

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

Notxsomeone commented 6 months ago

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.