RandyGaul / cute_headers

Collection of cross-platform one-file C/C++ libraries with no dependencies, primarily used for games
4.24k stars 264 forks source link

Adjust variable declarations to be able to compile it using a pre-C99 compiler #291

Closed mupfdev closed 2 years ago

mupfdev commented 2 years ago

C89 provides that variables are declared at the beginning of their scope. In addition, variables cannot be declared in for-loops.

This problem mainly affects older compilers, such as GCC 2.9-psion-98r2 in my case.

RandyGaul commented 2 years ago

Are you confident this is a bug free change?

mupfdev commented 2 years ago

I just made a full review of my changes and yes, I am confident. In almost all cases, I simply copied the variable declaration and moved it to the beginning of its scope. I have carefully considered all exceptions to this rule.