Some time ago doing a project in c i ended up using a beautiful feature of gcc (i found out only later that it's not standard, but still supported by gcc for c language), of being able to write a function in a specific scope.
That function would not exist outside of the scope, and can access all variables of that scope, pretty much the way a normal function can access globals.
And in a couple cases this is really amazing.
Now i'm not asking if it's possible in c++, i know it's not.
The two workarounds only achieve the "not exist outside of the scope feature", but both lack the "access all varibles of that scope" one. (which are dummy class or local lambda assigned to a function type variable.)
What i'm asknig is:
1) Why aren't nested functions part of both C and C++ standard? Is there any specific reason, considered it's clearly possible since gcc already does that?
2) Why there isn't a C++ adaptation to the non-standard nested classes system used in C by gcc?
3) Why isn't the idea of adding nested functions to the standard being taken into account? (it isn't as far as i know at least, i might likely be wrong)
That function would not exist outside of the scope, and can access all variables of that scope, pretty much the way a normal function can access globals.