| Build with -Wall dammit! |
[Feb. 8th, 2005|07:31 am] |
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 |
|
|