Nagios headers fails to compile in C++

Matthieu Kermagoret mkermagoret at merethis.com
Thu Dec 16 13:19:11 CET 2010


On Thu, Dec 16, 2010 at 11:25 AM, Andreas Ericsson <ae at op5.se> wrote:
> Oh. Can't C++ handle types as variable names? That's pretty weak tbh.

Nop it cannot.

> I'll make a note of it. In the future, the object types will be either
> "struct <type>" or "<type>_object". We save no typing for either case,
> and abbreviating "_object" to "_obj" seems a bit silly to me. We'll
> probably go with "struct host". That will also make it possible to
> name instances of the structs to the type they're referring to, such
> that
>
>  struct host *host;
>
> works well. Does this also work nicely with C++, or do we have to play
> prefix/suffix games?
>

It does not work, because the struct keyword becomes optional when
declaring a variable such as

struct host { /* struct content */ };
host h;

is perfectly valid C++.

Wouldn't the _t suffix be appropriate (ie. host_t, service_t) ? It is
a widely used suffix for type names.

Best regards,

-- 
Matthieu KERMAGORET | Développeur

mkermagoret at merethis.com

MERETHIS est éditeur du logiciel Centreon.

------------------------------------------------------------------------------
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
_______________________________________________
Nagios-devel mailing list
Nagios-devel at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-devel


More information about the Developers mailing list