Article View: comp.os.os2
Article #265Re: MSC __STDC__ strange value
From: Dion Hollenbeck
Date: Tue, 05 Dec 1989 15:41
Date: Tue, 05 Dec 1989 15:41
45 lines
1629 bytes
1629 bytes
From article <223@bohra.cpg.oz>, by ejp@bohra.cpg.oz (Esmond Pitt):
> For some strange reason, the MSC 5.1 compiler defines __STDC__ as 0, so
>
> #if __STDC__
> ...
> #endif
This means: Take the DEFINED macro __STDC__ and test its value and
return TRUE if non-zero and FALSE if zero
>
> yields a different result from
>
> #ifdef __STDC__
> ...
> #endif
>
> Why?
This means: Look to see if the macro __STDC__ is defined. If
it is defined, return TRUE and if it is not defined
return FALSE.
The difference is the basic definition of #if and #ifdef. #if
tests the value of a defined macro and #ifdef tests for its
existence. In all code I have seen (I have lots of source to
packages which I use) written to support several different compilers,
the test always made is the #ifdef test.
By the way,
#define __STDC__ /* evaluates __STDC__ = 0 */
while
#define __STDC__ 1 /* evaluates __STDC__ = 1 */
You will only get the #if test to be true if the macro IS DEFINED
and IS DEFINED TO BE NON-ZERO.
Hope this helps.
Dion Hollenbeck (619) 455-5590 x2814
Megatek Corporation, 9645 Scranton Road, San Diego, CA 92121
uunet!megatek!hollen or hollen@megatek.uucp
Technical Details
Message-ID:
<841@megatek.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!clyde!uunet!ncrlnk!ncr-sd!hp-sdd!megatek!eta!hollenReferences:
<223@bohra.cpg.oz>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!clyde!uunet!ncrlnk!ncr-sd!hp-sdd!megatek!eta!hollen From: hollen@eta.megatek.uucp (Dion Hollenbeck) Newsgroups: comp.os.os2,comp.lang.c,comp.std.c Subject: Re: MSC __STDC__ strange value Message-ID: <841@megatek.UUCP> Date: 5 Dec 89 15:41:34 GMT References: <223@bohra.cpg.oz> Sender: news@megatek.UUCP Lines: 45