How to make a simple universal binary; and other things learned about gcc

Although this is not my first time around the block regarding gcc, I have never gone much further than editing makefiles, and use flags under gentoo. Here is what I learned today; I am writing it down in the hopes that I will not have to learn these things again.

1. gcc, the Free Software Foundation’s C compiler, does not comply with the ISO/ANSI standard unless you include the -pedantic command line switch. (-ansi just turns off various GNU extensions.)

2. To get the full effect of the built-in error-checking, you need to use -O along with -Wwhatever. I recommend using -Wall -O until you feel you know C, then you should use whatever additional -W switches you feel are appropriate. The -O switch has to do with optimizing code but it also enables checking for uninitialized variables.

3. To make a universal binary that will run on my laptop + my home ppc based macs I have to use “-arch i386 -arch ppc”

Final: I am compiling now using “gcc -pedantic -Wall -O -arch i386 -arch ppc filename.c -o filename” -Peace-

gnu gcc logo