[SDL] Re: Segmentation Fault weirdness..

Albert Cahalan albert at users.sf.net
Sat Jan 22 20:57:33 PST 2005


On Sat, 2005-01-22 at 23:42, jimrandomh wrote:
> mo <thesilent1 at sympatico.ca> wrote:
> 
> > Ok, here is a tgz of the files:
> > http://thesilent1.freeownhost.com/sdl003.tgz . I compile it with
> > this command: gcc sdl003.c -o sdl003 `sdl-config --cflags --libs`
> > but a Makefile is included.
> 
> You should always compile with -Wall to enable warnings; they tend to 
> reveal things you ought to know.

Note that, despite the name, -Wall doesn't give you anywhere
near "all" of the warnings you could use. I use this:

PKG_CFLAGS   := -fno-common -ffast-math \
  -W -Wall -Wshadow -Wcast-align -Wredundant-decls \
  -Wbad-function-cast -Wcast-qual -Wwrite-strings -Waggregate-return \
  -Wstrict-prototypes -Wmissing-prototypes
#CFLAGS       := -O2 -s    # best warnings, compact, fast
CFLAGS       := -O1 -ggdb   # good debugger support
ALL_CFLAGS   := $(PKG_CFLAGS) $(CFLAGS)

Without that -O2 you won't get all the warnings. The compiler
simply won't bother to do all the analysis needed.






More information about the SDL mailing list