It is almost common knowledge that one should always compile with -Wall.
What other useful options are you using when compiling with gcc/g++?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You may want
-Wextrain addition of-Wall.When debugging your program,
-gis needed bygdb.and GCC accepts both
-gand-Oif you really wantAt last, recent versions of GCC (i.e. 4.6 or the 4.7 snapshot) gives better warnings than older ones.
You could use
-pedanticand restrict yourself to some standard, avoiding GNU extensions.I love GNU extensions so I don’t want to avoid them.
So I use
-std=gnu99for C code, and-std=gnu0xor-std=gnu11for C++11 code because I like extensions.And you might consider using or even developing a GCC plugin or a MELT extension for your own specific needs.