[GRASS5] compiling code

Glynn Clements glynn.clements at virgin.net
Wed May 7 06:05:25 EDT 2003


Markus Neteler wrote:

> > > When I try to compile outside of grass, fseek, fopen
> > > printf, etc need stdio.h.
> > >
> > > gcc -g -Wall -D__USE_FIXED_PROTOTYPES__ -ansi test.c
> > >
> > > How is that being included in Grass code?
> > 
> > stdio.h is included in gis.h. But in my experience lots of GRASS programs
> > are missing header files. It is usually more recent additions however, not the
> > older ones.
> 
> ... this is an invitation to compile GRASS with -Wall. All
> developers may eliminate compiler warnings whenever possible
> (delete unused variables, add missing headers etc).

But don't just "make the warnings go away". Unless you are sure that
you are fixing the actual problem, it's better that the warning
remains; it may be the only clue that there's a bug.

In particular, don't add type casts unless you have a *good*
understanding of C, especially portability issues (e.g. alignment,
aliasing, sizes of primitive types).

-- 
Glynn Clements <glynn.clements at virgin.net>




More information about the grass-dev mailing list