Tuesday, July 13, 2010

Recommended compiler options in gcc

These are the recommended compiler options for catching most of the errors in c/c++ program.

-ansi -pedantic -Wall -W -Wconversion -Wshadow -Wcast-qual -Wwrite-strings

You can alias it with gcc/g++ in your bashrc/zshrc and your life will become a bit cooler ;)

alias g++="g++ -ansi -pedantic -Wall -W -Wconversion -Wshadow -Wcast-qual -Wwrite-strings"

alias gcc="gcc -ansi -pedantic -Wall -W -Wconversion -Wshadow -Wcast-qual -Wwrite-strings"

Ref : http://www.network-theory.co.uk/docs/gccintro/gccintro_32.html

No comments: