In Linux, GCC is a common compilation tool. However, there are many special parameters during GCC compilation, such as compiling to a dynamic link library. Here I would like to mention how to use the GCC warning function to Improve the Quality of code writing.
For example, we want to eliminate useless local variables and unused function parameters. If we use manual check, this workload is very large. It is very easy to use GCC here. In GCC, several parameters are implemented in combination with-W. Unused-variable is a local variable that is not used. Unused-parameter is a function parameter that is not used, implicit-function indicates that the function is used without declaration. Char-subscripts indicates that the char type is used as the array subscript. If the return type does not match, the corresponding return-type is used.
For example,-wunused-parameter-wunused-variable indicates that you need to check both used parameters and unused local variables. -Wall indicates that all checks are enabled,-wall-wnounused-parameter indicates that unused parameters are enabled, and other checks are enabled. -Wuninitialized checks whether automatic variables are initialized before use. When this parameter is enabled, note that the-O option must be added to optimize compilation.
For more details about GCC compilation options, see http://php.freehostingguru.com/gcc_2.htm