Fritz Anderson's Weblog

Observations and Emendations

Title: Section 23.2: Embedded Function
Category: /Step into Xcode
Posted by:
Previous: Whole Lot of Errata
Next: Email Link Repaired

I thought I had rid my examples of embedded functions, but one slipped by. As of Xcode 2.2, gcc prohibits the use of embedded functions — functions declared inside another function or method. Section 23.2, by my oversight, includes at page 380 a function, IsQuoted, embedded in the testQuotation method. 
 
Embedded functions are now prohibited because gcc implemented them by pushing the code onto the stack, and executing them there. Many security exploits work by executing code injected into the stack, and it is a prudent security measure to make the stack non-executable, even at the expense of embedded functions. 
 
In this case, you can just move the IsQuoted function outside the testQuotation method, and the file will compile cleanly. 
 
Thanks to Sabreur for finding the bug. 

Login Information
Username:
Password: