[GRASS5] compiling code

Markus Neteler neteler at itc.it
Wed May 7 08:59:15 EDT 2003


On Wed, May 07, 2003 at 11:05:25AM +0100, Glynn Clements wrote:
> 
> 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.

I was thinking of unused variables and cases where e.g. fprintf()
is used but <string.h> not included, the same for exit() and
so on.
 
> 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).
I won't do that :-)

Markus




More information about the grass-dev mailing list