Non-portable features shall be clearly separated from portable ones in either:
- ifdef macro blocks
- separate files
- separate directories
- separate repositories
This includes features which were not present in the first standardized version of languages. E.g., C99 features must be put inside #ifdf __STDC_VERSION__
blocks.
Everything that can be checked in an assertion will be checked, and will not get printed.
For example, a C addition operator +
test should be done as:
assert(1 + 1 == 2);
and never:
printf("%d\n", 1 + 1);
so that all can be verified automatically.
Features which yield unpredictable outputs can print results to stdout. For example, time(NULL)
printf("%d\n", 1 + 1);
Features that:
- require user input such as C
scanf
- make programs wait for perceptible amounts of time
shall be put inside a block analogous to a if (0){ ... }
to be turned on only when users want to test those specific features.
Cheat source comments are written in markdown indented by headers and commented out.
Every important keyword that one might search for in the feature has a hash before it, e.g. #function
, #include
, #printf
, etc.