...
Compliant Solution (Testing for definition of macro)
In this compliant examplesolution, the definition of the predefined macro __STDC__
is tested before the value of the macro is tested:
Code Block | ||||
---|---|---|---|---|
| ||||
#include <stdio.h> int main(void) { #if defined(__STDC__) #if (__STDC__ == 1) printf("Implementation is ISO-conforming.\n"); #else printf("Implementation is not ISO-conforming.\n"); #endif #else /* !defined(__STDC__) */ printf("__STDC__ is not defined.\n"); #endif /* ... */ return 0; } |
Compliant Solution (Test for Optional feature)
The follow example This compliant solution tests to see if the C11 predefined macro __STDC_ANALYZABLE__
is defined and what value the implementation has given the macro:
...
Compliant Solution (Optional Language Features)
The following example This compliant solution checks for the C11 optional language features in Annex K. If Annex K is supported by the implementation, the functions defined in Annex K are used, if Annex K is not supported, then the Standard library functions are used. (See DCL09-C. Declare functions that return errno with a return type of errno_t.)
...