Re: Preprocessor Directives
- From: Lawrence Kirby <lknews@xxxxxxxxxxxxxxx>
- Date: Tue, 05 Jul 2005 10:53:51 +0100
On Mon, 04 Jul 2005 15:52:19 -0400, Eric Sosman wrote:
....
> As it happens, a compiler that predefines WIN32 (without
> being provoked by a command-line option or something) is not
> Standard-conforming.
It creates a non-conforming implementation whether WIN32 is built in or
specified in the command line. The conformance of a compiler is highly
dependent on the command line options given to it, including macro
predefinitions.
> The identifier WIN32 should be available
> for any use the programmer cares to make of it. The following
> is a strictly conforming program, and a compiler whose predefined
> names clash with anything here is non-conforming:
>
> #include <stdio.h>
> #include <stdlib.h>
> #define SPARC EXIT_SUCCESS
> #define I386 EXIT_FAILURE
> int main(int WIN32, char **STDC) {
> char UNIX[] = "Hello, world!";
> int VAX = puts(UNIX);
> return VAX == EOF ? SPARC : I386;
> }
Right, if any command line options break that code they have broken the
conformance of the implementation.
The program does curiously return EXIT_SUCCESS when puts() fails.
Lawrence
.
- Follow-Ups:
- Re: Preprocessor Directives
- From: CBFalconer
- Re: Preprocessor Directives
- References:
- Preprocessor Directives
- From: Water Cooler v2
- Re: Preprocessor Directives
- From: Eric Sosman
- Preprocessor Directives
- Prev by Date: Re: C Primitive Data Type Sizes
- Next by Date: Re: will the memory allocated by malloc get released when program exits?
- Previous by thread: Re: Preprocessor Directives
- Next by thread: Re: Preprocessor Directives
- Index(es):
Relevant Pages
|
|