Nagios headers fails to compile in C++

Andreas Ericsson ae at op5.se
Wed Dec 15 14:43:33 CET 2010


On 12/15/2010 12:13 PM, Matthieu Kermagoret wrote:
> Hi list,
> 
> While working on a NEB module written in C++, I found out that out of
> the box Nagios headers could not compile properly. This patch correct
> this behavior by modifying slightly the API of the commandsmember and
> notification structures (but not the ABI).
> 
> What do you think about it ?
> 

It can't go in before 3.3 at the earliest. Otherwise I think it's a
pretty good idea to either stay away from C++ reserved words entirely
or declare plain C as the only valid language for NEB modules.

An acceptable patch right now would be to surround the offending
variable names with
#ifndef __cplusplus
	/* original implementation */
#else
	/* c++ style names */
#endif

although I realize that such a change would be a lot more cumbersome.
It would however attract more attention so we stay away from C++
reserved words when redesigning the object structure, assuming we
actually remember which ones they are. Although I suppose that can
be quite easily tested by attempting to compile Nagios with g++
instead of gcc.

-- 
Andreas Ericsson                   andreas.ericsson at op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.

------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d




More information about the Developers mailing list