• 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: No Breakpoints on Unused Variables
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: No Breakpoints on Unused Variables


  • Subject: Re: No Breakpoints on Unused Variables
  • From: Andreas Grosam <email@hidden>
  • Date: Wed, 10 Aug 2011 09:50:02 +0200

On Aug 10, 2011, at 12:29 AM, Jeffrey Walton wrote:

> For what its worth, I don't believe Xcode sets up a 'debug'
> configuration correctly. In addition to the above, -DDEBUG is not
> defined.
Xcode 4.1 actually defines macro  DEBUG=1 in the template projects (at least for C++ console apps, which I just verified.)

The macro DEBUG isn't POSIX, though. It is used in Apple's Carbon framework and DEBUG shall have a value which specifies the debug level. So, IMHO, it is somewhat misplaced in a C/C++ console program.
The default setting from the template project (DEBUG=1) means, Carbon assertions include file and line number information. There are four debug levels:
DEBUG_LEVEL_PRODUCTION (0)
DEBUG_LEVEL_BREAK_ONLY (1)
DEBUG_LEVEL_EXTERNAL  (3)
DEBUG_LEVEL_INTERNAL  (4)

You can read more on this in CarbonCore/Debugging.h


Then, there is the macro NDEBUG, which is POSIX, and which is used in the assert macro. File <assert.h> is a ISO/ POSIX/C99 header.
This macro is NOT defined in Xcode's project templates!



> Others can probably list more debug options not present in
> the stock Apple configuration. Also be aware of a 'release'
> configuration, which lacks -DNDEBUG. Software written against POSIX
> might do awful things (like call abort() after an assert) because the
> macro was not removed as specified.
Exactly. And in fact, what I do first when creating a project is defining NDEBUG in the release configurations ;)

I wish, Xcode would have defined NDEBUG, rather than DEBUG=1 in all but Cocoa based project templates.

Andreas


>
> Matt Neuburg's book discusses issues similar to these. Of all my books
> on iOS and Mac OS X programming, his is the only one which discusses
> the topic. Its unfortunate more authors don't take the time to explain
> tools to a user.
>
> Jeff

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >No Breakpoints on Unused Variables (From: Gordon Apple <email@hidden>)
 >Re: No Breakpoints on Unused Variables (From: Jeffrey Walton <email@hidden>)

  • Prev by Date: about pdf content parsing (Chinese or Korea or Japanese)
  • Next by Date: Adding a custom background to the More Screen
  • Previous by thread: Re: No Breakpoints on Unused Variables
  • Next by thread: [ANN] Article on automated on-device testing on iOS (and Android)
  • Index(es):
    • Date
    • Thread