[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]
Ð ë ê þ ã K wrote (deepak2000@xxxxxxxxxxxx):
> i tried compiling a c program as
> cc myprog.c
This is slightly unrelated, but still worth knowing.
_Never_ compile you program without including any warning flags.
"cc foo.c" or "gcc foo.c" will silently compile nearly anything you throw at
Here is a simple replacement... this script is named "gnuc" and you use it by
doing "gnuc foo.c" instead of "gcc foo.c". Note that this scripts puts gcc in
ansi compilant mode (and paranoid warning level:) and is very restrictive. It
also enables debugging properly (-g -00; try stepping through optimized code
and you will realise) (this also relates to some previous posts).
This script is a real overkill, and may even refuse to compile some
legitimate C progs (it is primarily used to compile 1st yr under grad
projects). Do not compile production code with this, only debugging code.
PS: Appologies for a possible double post... I think I stuffed up my first
# File: gnuc
# This runs gcc with all warnings enabled, except for the following
# -Wredundant-decls causes too many complaints in system header files
# -Wconversion really only intended to help people using `unprotoize'
# -Waggregate-return not useful, IMHO
# -Wenum-clash doesn't work with gcc 2.7.x
# fjh, Tue Oct 29 1996
OPTS="-ansi -pedantic -D_LONGLONG
-Wall -Wwrite-strings -Wid-clash-31 -Wpointer-arith -Wcast-qual
-O -felide-constructors -fnonnull-objects
exec gcc $OPTS "$@"