Re: [Nagios-devel] Issue with objects.h
Posted: Mon Sep 17, 2012 2:06 pm
On 09/17/2012 01:18 PM, Jean-François Rameau wrote:
> hey all,
>
> I'm trying to build my own broker using C++ language ( g++-4.7.real (Debian
> 4.7.1-2) 4.7.1, nagios 3.4.1 ).
>
> Something goes wrong when g++ compiles the commandsmember structure in
> objects.h :
>
> /* COMMANDSMEMBER structure */
> typedef struct commandsmember_struct {
> char *command;
> #ifdef NSCORE
> command *command_ptr;
> #endif
> struct commandsmember_struct *next;
> } commandsmember;
>
> ../include/objects.h:180:2: error: ‘command’ does not name a type. I think
> it is C++'s rule C++11 3.3.10/1:
>
> "A name can be hidden by an explicit declaration of that same name in a
> nested declarative region or derived class."
>
> So I came with that patch which seems to be the best way to get both gcc
> and g++ happy.
>
> --- objects.h.org 2012-08-12 17:46:35.000000000 +0200
> +++ objects.h 2012-08-12 18:00:24.000000000 +0200
> @@ -177,7 +177,7 @@
> typedef struct commandsmember_struct {
> char *command;
> #ifdef NSCORE
> - command *command_ptr;
> + struct command_ptr *command_ptr;
> #endif
How can this possibly make gcc happy? "struct command_ptr" is not
a type no matter if you use C or C++.
I'd be all for renaming "host" to "struct host" everywhere and
doing the same for all obects (but not before 5.0 :-/), but this
patch can't compile at all.
--
Andreas Ericsson [email protected]
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.
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
> hey all,
>
> I'm trying to build my own broker using C++ language ( g++-4.7.real (Debian
> 4.7.1-2) 4.7.1, nagios 3.4.1 ).
>
> Something goes wrong when g++ compiles the commandsmember structure in
> objects.h :
>
> /* COMMANDSMEMBER structure */
> typedef struct commandsmember_struct {
> char *command;
> #ifdef NSCORE
> command *command_ptr;
> #endif
> struct commandsmember_struct *next;
> } commandsmember;
>
> ../include/objects.h:180:2: error: ‘command’ does not name a type. I think
> it is C++'s rule C++11 3.3.10/1:
>
> "A name can be hidden by an explicit declaration of that same name in a
> nested declarative region or derived class."
>
> So I came with that patch which seems to be the best way to get both gcc
> and g++ happy.
>
> --- objects.h.org 2012-08-12 17:46:35.000000000 +0200
> +++ objects.h 2012-08-12 18:00:24.000000000 +0200
> @@ -177,7 +177,7 @@
> typedef struct commandsmember_struct {
> char *command;
> #ifdef NSCORE
> - command *command_ptr;
> + struct command_ptr *command_ptr;
> #endif
How can this possibly make gcc happy? "struct command_ptr" is not
a type no matter if you use C or C++.
I'd be all for renaming "host" to "struct host" everywhere and
doing the same for all obects (but not before 5.0 :-/), but this
patch can't compile at all.
--
Andreas Ericsson [email protected]
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.
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]