This post originated from an RSS feed registered with Ruby Buzz
by Daniel Berger.
Original Post: Build with -Wall dammit!
Feed Title: Testing 1,2,3...
Feed URL: http://djberg96.livejournal.com/data/rss
Feed Description: A blog on Ruby and other stuff.
Here's a bit of advice to anyone writing C extensions for Ruby and gcc: always build with -Wall. Just stick "export CC='gcc -Wall'" in your .bashrc file, or your preferred shell's equivalent. If you're feeling extra careful, add an extra '-W' at the end of that.
It's a great way to catch potential problems in your C source. Heck, I've found even found bugs in the code of some of our more esteemed C coders this way.
I'm just tired of seeing gobs of warnings in C extensions that could be avoided by building with -Wall. Probably the number one warning is "unused variable" - sloppy. I know that sometimes warnings are unavoidable, and that's fine as long as you mention it somewhere in the docs. Otherwise, your code should be warning free