Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Nested functions are not supported on MacOSX

Name: Anonymous 2006-01-03 17:24

You wanted a programming thread?


(This, by the way, refers to nested functions in C code. A gcc extension)

"gcc's implementation of nested functions involves placing code on the stack and then executing it. Stack execution is a common operation in malicious code, particularly as a side effect of buffer overflows. While the proper fix is of course to not make buffer overflows possible in the first place, disabling stack execution decreases the likelihood that a buffer overflow or other stack-smashing attack will be exploitable."

"In future releases of Mac OS X, we may disable stack execution. (Obviously we'll have to keep binary compatibility in mind when or if we do that.) Nested functions were disabled to help prepare for that change."

"As for whether nested functions will be re-enabled, if someone contributes a patch to GCC to change the nested function implementation to not rely on stack execution, presumably there'd be a chance they'd be re-enabled."


Are Apple evil or awesome for doing this? (discussion!)

How would you go about implementing nested functions without using stack execution? (technical challenge!)

Or we could go back to flaming Java.

Name: Anonymous 2011-07-28 22:18

>>24
Nested functions are a form of information hiding and are useful for dividing procedural tasks into sub tasks which are only meaningful locally; it avoids cluttering other parts of the program with functions, variables, etc. unrelated to those parts. Nested functions therefore complement other structuring possibilities such as records and objects.

In languages with nested functions, functions may normally also contain local constants, and types (in addition to local variables, parameters, and functions), encapsulated and hidden in the same nested manner. This may further enhance the code structuring possibilities.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List