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
åstandards!\n”);
#else
printf(“Shame on you, you nonconformist anti-ANSI rabble-rousing
åprogrammer!\n”);
#endif
...
Cross Reference:
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
åstandards!\n”);
#else
printf(“Shame on you, you nonconformist anti-ANSI rabble-rousing
åprogrammer!\n”);
#endif
...
Cross Reference:
V.1: What is a macro?
V.24: What is the _ _FILE_ _ preprocessor command?
V.26: What is the _ _LINE_ _ preprocessor command?
V.28: What are the _ _DATE_ _ and _ _TIME_ _ preprocessor commands?
No comments:
Post a Comment