API : objects.h not compliant with C++ ?
Posted: Sun Aug 12, 2012 11:14 am
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
struct commandsmember_struct *next;
} commandsmember;
jfr
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
struct commandsmember_struct *next;
} commandsmember;
jfr