• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: hey, who took away nested functions?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: hey, who took away nested functions?


  • Subject: Re: hey, who took away nested functions?
  • From: Dirk Stegemann <email@hidden>
  • Date: Thu, 5 Jan 2006 21:09:00 +0200

Hi,

Am 05.01.2006 um 19:30 schrieb Matt Neuburg:
My code uses nested functions:

<http://developer.apple.com/documentation/DeveloperTools/gcc-4.0.1/ gcc/Neste
d-Functions.html>


It used to compile, but now it won't:

  "nested functions are not supported on MacOSX"

What happened? Thx.


This topic has been discussed recently on Apple's "Xcode-users" mailing list; from an Apple engineer:

-----snip-----

Re: gcc-4.0.1 = nested functions are not supported on MacOSX?

On Nov 10, 2005, at 10:24 PM, Daryn wrote:

The new xcode 2.2's gcc 4.0.1 compiler update has apparently dropped support for nested functions. Apple's release notes for gcc do not even mention this change... :(

Before I downgrade to gcc 4.0, is there a command line option to re-enable nested functions?

Why were they disabled? Are they going to be re-enabled?

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.

Hope this helps,
Eric

-----snip-----

Regards,
Dirk Stegemann




_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >hey, who took away nested functions? (From: Matt Neuburg <email@hidden>)

  • Prev by Date: Re: Globaly unique NSManagedObjectID
  • Next by Date: Re: UNICODE from a WinTel box
  • Previous by thread: Re: hey, who took away nested functions?
  • Next by thread: Re: hey, who took away nested functions?
  • Index(es):
    • Date
    • Thread