[GRASS5] #include _GRASS_GIS_LIB_

Hamish hamish_nospam at yahoo.com
Wed Apr 26 03:42:08 EDT 2006


> > in include/display.h we have:
> > 
> > #ifndef _GRASS_GIS_LIB_
> > #include <grass/gis.h>
> > #endif
> > #ifndef _GRASS_DISPLAY_LIB_
> > #define _GRASS_DISPLAY_LIB_
> > 
> > 
> > in include/segment.h we have:
> > 
> > #ifndef _GRASS_GIS_LIB
> > #include <grass/gis.h>
> > #endif
> > 
> > (note no trailing "_" in _GRASS_GIS_LIB)
> > 
> > 
> > are any of these even used?
> 
> AFAICT, no. Certainly, gis.h doesn't define either of those macros.
> 
> > should 
> > #include <grass/gis.h>
> > 
> > just be included without a test?
> 
> Yes.
> 
> Header files should protect themselves against repeated inclusion,
> e.g.
> 
> 	#ifndef GRASS_GIS_H
> 	#define GRASS_GIS_H
> 
> 	<rest of header file>
> 
> 	#endif /* GRASS_GIS_H */
> 
> This is already done for the most important headers, including gis.h.


display.h, segment.h updated in CVS.


Hamish




More information about the grass-dev mailing list