C/C++ issues
The code I'm trying to port (UNIX->Windows) is an extreme fan of this convention:
Visual Studio flips out and cries when this happens; the very same code compiled happily in GCC under Cygwin. I saw something somewhere that declaring functions inside other functions is strictly forbidden in C; is this true? Does GCC waive this little restriction? Is there anything else I can do about this than make the function and the variable global? I suppose I could make a struct that has those variables within it, add that as an argument to otherfunction and everything else that's ever aware of it, but that sounds like a royal pain. Is there a setting somewhere that makes this possible again?
click
void function() { int variable, othervariable; int otherfunction(arguments) { doStuff(arguments); doDifferentStuff(variable, othervariable); return result; } doSomethingElse(otherfunction); }
Visual Studio flips out and cries when this happens; the very same code compiled happily in GCC under Cygwin. I saw something somewhere that declaring functions inside other functions is strictly forbidden in C; is this true? Does GCC waive this little restriction? Is there anything else I can do about this than make the function and the variable global? I suppose I could make a struct that has those variables within it, add that as an argument to otherfunction and everything else that's ever aware of it, but that sounds like a royal pain. Is there a setting somewhere that makes this possible again?
click