[GRASS5] #include _GRASS_GIS_LIB_

Glynn Clements glynn at gclements.plus.com
Mon Apr 24 11:53:18 EDT 2006


Hamish wrote:

> 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.

-- 
Glynn Clements <glynn at gclements.plus.com>




More information about the grass-dev mailing list