title: C/GCC Warnings - Write once and test everywhere?
body: <p>I'm writing a command line program in ANSI C to parse a Quake 2 map file to report how many entities and textures are being used.  My development machine is MacBook.  I'm testing on OS X Snow Leopard (32-bit), Windows XP (32-bit) and Vista (64-bit), and Ubuntu 9.10 (32-bit).  </p>
  
  <p>The code is flawless on the OS X and GCC 4.2.  The other platforms, not so flawless.</p>
  
  <p>Visual Studio 2005 complained about an array declaration in the middle of the main() block -- size info for the array isn't available until then--that should be declared at top.  Fixed that by declaring a pointer at top and writing a function to create the array.</p>
  
  <p>Dev-C++ and GCC (3.4) on Windows has no complaints.</p>
  
  <p>Cygwin and GCC (4.4) on Windows complained about array subscript has type char.  I added (int) casts to fix that.</p>
  
  <p>Ubuntu and GCC (4.4) is complaining about ignoring the return value of fread.  Although I read elsewhere that I might be a bug in the way Ubuntu packaged GCC.  Seems like this one in the context I'm using fread in may be safe to ignore. The warning only appears with the -O3 flag.</p>
  
  <p>Except for Visual Studio 2005, all the compilers that I tested with are some version of GCC. Chasing down all these errors and warnings is serious pain in the butt.  Until now, I been using the following flags in my Makefile:</p>
  
  <p>debug: -pedantic -Wall</p>
  
  <p>release: -O3</p>
  
  <p>Is there a set of GCC flags that I should be using to catch all the errors on my primary development machine?  Or is write once and test everywhere a fact of life? </p>