Re: Test for debug vs release
Re: Test for debug vs release
- Subject: Re: Test for debug vs release
- From: Clark Cox <email@hidden>
- Date: Sun, 21 Mar 2010 11:10:44 -0700
On Sun, Mar 21, 2010 at 11:01 AM, Don Quixote de la Mancha
<email@hidden> wrote:
> You can also do:
>
> #if !defined( NDEBUG )
> /* Debugging Stuff Goes Here *.
> #endif
>
> I don't have an Xcode install handy to actually check (I'm
> reinstalling my Mac today), but NDEBUG *should* be defined for release
> builds, and not defined for debug builds.
>
> The reason is that the assert macro in <assert.h> disables itself if
> NDEBUG is defined. I am under the impression that the presence or
> absence of NDEBUG is specified by the ANSI C definition, but I'm not
> completely certain.
>
The presence or absence of NDEBUG is not defined by the C standard
*however* the behaviour of the assert macro, when *you* define NDEBUG,
*is* specified:
"If NDEBUG is defined as a macro name at the point in the source file
where <assert.h> is included, the assert macro is defined simply as
#define assert(ignore) ((void)0)"
--
Clark S. Cox III
email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden