This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Is there a parameter called _DEBUG?
- From: Lin George <george4academic at yahoo dot com>
- To: John Love-Jensen <eljay at adobe dot com>, MSX to GCC <gcc-help at gcc dot gnu dot org>
- Date: Tue, 29 Aug 2006 06:32:18 -0700 (PDT)
- Subject: Re: Is there a parameter called _DEBUG?
Thank you John!
Do you mean _DEBUG is not defined and used by gcc
itself on Linux platform and it may be used in
application code (especially the ones from Microsoft
Windows platform)?
regards,
George
--- John Love-Jensen <eljay@adobe.com> wrote:
> Hi George,
>
> The _DEBUG define is (as far as I am aware) a
> Microsoft-ism convention.
> Some people have taken that convention to heart, and
> rely upon it in their
> own environments -- even non-Microsoft environments.
>
> For debug builds, the _DEBUG is defined. Caution:
> in C++, _DEBUG is a
> reserved identifier, use at your own peril.
> (Microsoft legitimately uses it
> in their compiler, since those kind of identifiers
> are reserved for the
> compiler vendor to use as they see fit.)
>
> For non-debug builds (release builds), the NDEBUG is
> defined. Note: NDEBUG
> has a long history in C. Look at the "assert.h"
> header. I believe NDEBUG
> is used on every platform that supports C/C++. If
> an "NDEBUG" symbol were
> to be introduced today, it would be _NDEBUG, but
> because of its provenance,
> it is NDEBUG.
>
> I recommend using the presence or absence of NDEBUG
> as the trigger for code
> that is release (#ifdef NDEBUG) or debug (#ifndef
> NDEBUG). Even thought I
> have a bit of distaste for "#ifndef NDEBUG" because
> of the double-negative
> makes my tiny little brain hurt.
>
> HTH,
> --Eljay
>
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com