Comment on Indirect Calling of Nested Functions on GCC Without Executable StackComments−BobbyTables213dHave always wondered, why can’t nested functions just be normal functions inside a namespace?It seems silly to expose a tiny helper to the entire compilation unit when it is only meant to be used inside one function…−wavemode13dwhy can’t nested functions just be normal functions inside a namespaceBecause GCC's nested functions are closures - they can access local variables within the function.
Comments
Have always wondered, why can’t nested functions just be normal functions inside a namespace?
It seems silly to expose a tiny helper to the entire compilation unit when it is only meant to be used inside one function…
Because GCC's nested functions are closures - they can access local variables within the function.