Thank You, GCC!
I've found myself writing a lot of C code this year. I've come to appreciate the power of a good compiler, especially when trying to walk other people through compiling my supposedly cross-platform code on Windows with MSVC.
GCC may not always produce the fastest code or compile with the greatest speed, but it's reliable, and once I have code compiling with GCC on Linux, I have confidence that it will compile for just about any other free Unix with GCC.
I've also come to appreciate several GCC flags and options. For example, GCC 4.x added a compiler flag called
-fvisibility=hidden. When you build a shared library with this flag, GCC will hide all symbols not explicitly marked as visible. As Windows DLLs require export lists of all symbols visible externally, enabling this feature for non-Windows compiles helps prevent me from adding a new symbol but forgetting to export it.
I'm also a fan of
-Wc++-compat, which gives copious warnings about dubious constructs which may choke a C++ compiler. Again, not all platforms have good C compilers available (mostly by disallowing the use of GCC), so making my code as clean as possible helps avoid a large porting burden later.
I know there are other good tools to analyze code, but for the cost of a few compiler and linker flags, I get a good cross-section of warnings that help me clean up my code--and a high-quality, cross-platform compiler for free.
Thank you, everyone who's contributed to GCC.
I've tried to use -Wc++-compat on one of my projects, but g++ says that this option is not recognized. I'm using this GCC:
Shameless self-promotion (yet fairly relevant): Ohloh lets people say thanks to individuals and open source projects. The GCC page is here: http://www.ohloh.net/projects/15.
@jmmv, the flag only works with