[An Introduction to GCC 学习笔记] 10 Warn预编译

Posted 漫小牛

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[An Introduction to GCC 学习笔记] 10 Warn预编译相关的知识,希望对你有一定的参考价值。

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.

以上是关于[An Introduction to GCC 学习笔记] 10 Warn预编译的主要内容,如果未能解决你的问题,请参考以下文章

[An Introduction to GCC 学习笔记] 09 -Wall

[An Introduction to GCC 学习笔记] 14 优化问题3

[An Introduction to GCC 学习笔记] 14 优化问题3

[An Introduction to GCC 学习笔记] 13 优化问题2

[An Introduction to GCC 学习笔记] 10 Warn预编译

[An Introduction to GCC 学习笔记] 07 链接外部静态库