How can you be sure that a program follows the ANSI C standard?


The ANSI C standard provides a predefined symbol named __STDC__ that is set to 1 when the compiler is enforcing strict ANSI standard conformance. If you want your programs to be 100 percent ANSI conformant, you should ensure that the __STDC__ symbol is defined. If the program is being compiled with non-ANSI options, the __STDC__ symbol is undefined. The following code segment shows how this symbol can be checked:

#ifdef __STDC__
     printf("Congratulations! You are conforming perfectly to the ANSI
     printf("Shame on you, you nonconformist anti-ANSI rabble-rousing programmer!\n");


© 2017