Re: Preprocessor Directives



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


.



Relevant Pages

  • Re: DOS Options
    ... Both MS-DOS and Win32 only ... Windows does appear to have a CommandLineToArgvW function that parses ... the command line. ... compiler vendors are rewriting their runtime to purposely break something ...
    (comp.lang.ada)
  • Re: gfortran iso c bindings - capabilities
    ... free to pick any companion processor it chooses. ... invoked with different command line options. ... if %errorlevel% NEQ 0 goto errorexit ... The compiler is supposed to incorporate the information about the ...
    (comp.lang.fortran)
  • Re: Invoking External Batch Program on Multiple Core Machine
    ... (Although free version of command line .NET compiler is available, so if some new feature would greatly ... work (you pass it a file in the command line, it runs for 2-45 minutes and spits out another file). ... This is very annoying since I have a dual core machine and would like to get my work done as quickly as possible. ... You can use the Process class to start a new process with a specific command, and you can even set the ProcessorAffinity on the class instance to control what CPUs it runs on. ...
    (microsoft.public.dotnet.languages.csharp)
  • RE: Visual studio 2003 .NET versus its own Command Prompt
    ... > package in the lab. ... > command line compiler which cames with it. ... library, which is a .lib file, for it to know where in the DLL the functions ...
    (microsoft.public.vc.language)
  • Re: Cant delete files that end with period
    ... Type or paste this command and then hit your Enter key... ... The file name includes an invalid name in the Win32 name space ... the file name has a trailing space or a trailing period ... the trailing spaces or periods are stripped before the actual file ...
    (microsoft.public.windowsxp.general)