I love compilers! I cannot code without them.
They can prevent entire classes of errors and warns if I accidentally try to do something stupid in the code.
Besides compiling code and checking for type and syntax errors, compilers can also print useful warnings.
I’m a fan of turning on all warnings and writing a “paranoidly” safe code just to avoid potential correctness and performance problems.
While coding in C/C++, I use to use
gcc with flag
-Wall. But did you know that it doesn’t enable all warning as the name suggests?
Some people know that there is an extra flag
-Wextra and few of them also know that there is one more
But even those 3 flags
-Wall -Wextra -Wpedantic will not turn on all of the possible warnings in
To turn on all warnings you have to use the following 14 switches:
-Wall -Wextra -Wpedantic -Wzero-as-null-pointer-constant \
-Wcomment -Wdouble-promotion -Wfloat-conversion -Wfloat-equal \
-Wformat-nonliteral -Wformat-security -Wformat-signedness \
-Wmissing-declarations -Wshadow -Wswitch-default
Article by Tomasz Kuczma
Software engineer with a passion. Interested in computer networks and large-scale distributed computing.
He loves to optimize and simplify software on various levels of abstraction starting from memory ordering through non-blocking algorithms up to system design and end-user experience. Geek. Linux user.
The views I express are my alone and they do not necessarily express the views of my employer or ex-employers.
They are not investment advice nor based on any non-public information of any kind.