Addtional Warning Options
GCC provides many other warning options that are not included in ‘-Wall’, but are often useful. Typically these product warning for source code which may be technically valid but is very likely to cause problems. The crieria for these options are based on experience of common errors - they are not included in ‘-Wall’ because they only indicate possibly problematic or ‘suspicious’ code.
- ‘-W’
- ‘-Wconversion’
- ‘-Wshadow’
- ‘-Wcast-qual’
- ‘-Wwrite-strings’
- ‘-Wtraditional’
Using the Preprocessor
- GNU C preprocessor cpp, is part of the GCC package. The preprocessor expands macros in source files before they are compiled. It is automatically called whenever GCC processes a C or C++ program.
- To define a macro a marco with a value, the ‘-D’ command-line option can be used in the form ‘-DNAME=VALUE’.
- When a macro is defined with ‘-D’ alone, gcc uses a default value of 1.
- You can use the ‘-E’ option of gcc to see the effect of the preprocessor on source files directly.