Re: [Nagios-devel] Nagios headers fails to compile in C++

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Guest

Re: [Nagios-devel] Nagios headers fails to compile in C++

Post by Guest »

On Thu, Dec 16, 2010 at 11:25 AM, Andreas Ericsson 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 " or "_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
>
> =C2=A0struct 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,

--=20
Matthieu KERMAGORET | D=C3=A9veloppeur

[email protected]

MERETHIS est =C3=A9diteur du logiciel Centreon.





This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
Locked