www.digitalmars.com         C & C++   DMDScript  

c++ - Problem with exotic constructor

reply "Johnny Willemsen" <jwillemsen remedy.nl> writes:
Hi,

I am having problems with the following constructor. Builds with all other
compilers, not with DMC. Is this a bug in DMC?

Regards,

Johnny Willemsen

class ACE_Export ACE_Multihomed_INET_Addr : public ACE_INET_Addr
{
public:
  ACE_Multihomed_INET_Addr(u_short port_number,
                           const char primary_host_name[],
                           int encode = 1,
                           int address_family = AF_UNSPEC,
                           const char *(secondary_host_names[]) = 0,
                           size_t size = 0);

Implementation:
ACE_Multihomed_INET_Addr::ACE_Multihomed_INET_Addr(u_short port_number,
                                                   const char host_name[],
                                                   int encode,
                                                   int address_family,
                                                   const char
*(secondary_host_names[]),
                                                   size_t size)
{


Compile output:
dmc -Ar  -ND  -g      -Ic:\ace\latest\ace_wrappers -DACE_NO_INLINE
-Ic:\ace\latest\ace_wrappers
 -DACE_HAS_ACE_TOKEN -DAC
E_HAS_ACE_SVCCONF -DACE_BUILD_DLL  -c  -o .shobj/Multihomed_INET_Addr.o
Multihomed_INET_Addr.cpp
Multihomed_INET_Addr.cpp:
                           const char *(secondary_host_names[]) = 0,
                                                            ^
c:\ace\latest\ace_wrappers\ace/Multihomed_INET_Addr.h(53) : Error: parameter
list is out of context
           const char *(secondary_host_names[]) = 0,
                                            ^
c:\ace\latest\ace_wrappers\ace/Multihomed_INET_Addr.h(96) : Error: parameter
list is out of context
                                                   const char
*(secondary_host_names[]),

        ^
Multihomed_INET_Addr.cpp(30) : Error: ')' expected to close function
parameter list with
                                                   size_t size){
                                                             ^
Multihomed_INET_Addr.cpp(31) : Error: 'size_t' previously declared as
something else
It was declared as: unsigned
It is now declared: int
  if (secondary_host_names && size){
   ^
Multihomed_INET_Addr.cpp(37) : Error: '=', ';' or ',' expected
Fatal error: too many errors
--- errorlevel 1
make[1]: *** [.shobj/Multihomed_INET_Addr.o] Error 1
make[1]: Leaving directory `/cygdrive/c/ACE/latest/ACE_wrappers/ace'
make: *** [ACE] Error 2

C:\ACE\latest\ACE_wrappers\ace>
Oct 19 2004
parent reply "Walter" <newshound digitalmars.com> writes:
Try omitting the secondary_host_names identifier in the declaration.

"Johnny Willemsen" <jwillemsen remedy.nl> wrote in message
news:cl3k0a$e6c$2 digitaldaemon.com...
 Hi,

 I am having problems with the following constructor. Builds with all other
 compilers, not with DMC. Is this a bug in DMC?

 Regards,

 Johnny Willemsen

 class ACE_Export ACE_Multihomed_INET_Addr : public ACE_INET_Addr
 {
 public:
   ACE_Multihomed_INET_Addr(u_short port_number,
                            const char primary_host_name[],
                            int encode = 1,
                            int address_family = AF_UNSPEC,
                            const char *(secondary_host_names[]) = 0,
                            size_t size = 0);

 Implementation:
 ACE_Multihomed_INET_Addr::ACE_Multihomed_INET_Addr(u_short port_number,
                                                    const char host_name[],
                                                    int encode,
                                                    int address_family,
                                                    const char
 *(secondary_host_names[]),
                                                    size_t size)
 {


 Compile output:
dmc -Ar -ND -g -Ic:\ace\latest\ace_wrappers -DACE_NO_INLINE -Ic:\ace\ latest\ace_wrappers
  -DACE_HAS_ACE_TOKEN -DAC
 E_HAS_ACE_SVCCONF -DACE_BUILD_DLL  -c  -o .shobj/Multihomed_INET_Addr.o
 Multihomed_INET_Addr.cpp
 Multihomed_INET_Addr.cpp:
                            const char *(secondary_host_names[]) = 0,
                                                             ^
 c:\ace\latest\ace_wrappers\ace/Multihomed_INET_Addr.h(53) : Error:
parameter
 list is out of context
            const char *(secondary_host_names[]) = 0,
                                             ^
 c:\ace\latest\ace_wrappers\ace/Multihomed_INET_Addr.h(96) : Error:
parameter
 list is out of context
                                                    const char
 *(secondary_host_names[]),

         ^
 Multihomed_INET_Addr.cpp(30) : Error: ')' expected to close function
 parameter list with
                                                    size_t size){
                                                              ^
 Multihomed_INET_Addr.cpp(31) : Error: 'size_t' previously declared as
 something else
 It was declared as: unsigned
 It is now declared: int
   if (secondary_host_names && size){
    ^
 Multihomed_INET_Addr.cpp(37) : Error: '=', ';' or ',' expected
 Fatal error: too many errors
 --- errorlevel 1
 make[1]: *** [.shobj/Multihomed_INET_Addr.o] Error 1
 make[1]: Leaving directory `/cygdrive/c/ACE/latest/ACE_wrappers/ace'
 make: *** [ACE] Error 2

 C:\ACE\latest\ACE_wrappers\ace>
Oct 19 2004
parent reply "Johnny Willemsen" <jwillemsen remedy.nl> writes:
Hi Walter,

The workaround you gave works, removing the identifier from the declaration 
resolves these errors, but this is not the way I like to go. I think this is 
a small bug in the DMC compiler, do you agree?

Johnny
"Walter" <newshound digitalmars.com> wrote in message 
news:cl4l65$1h5o$2 digitaldaemon.com...
 Try omitting the secondary_host_names identifier in the declaration.

 "Johnny Willemsen" <jwillemsen remedy.nl> wrote in message
 news:cl3k0a$e6c$2 digitaldaemon.com...
 Hi,

 I am having problems with the following constructor. Builds with all 
 other
 compilers, not with DMC. Is this a bug in DMC?

 Regards,

 Johnny Willemsen

 class ACE_Export ACE_Multihomed_INET_Addr : public ACE_INET_Addr
 {
 public:
   ACE_Multihomed_INET_Addr(u_short port_number,
                            const char primary_host_name[],
                            int encode = 1,
                            int address_family = AF_UNSPEC,
                            const char *(secondary_host_names[]) = 0,
                            size_t size = 0);

 Implementation:
 ACE_Multihomed_INET_Addr::ACE_Multihomed_INET_Addr(u_short port_number,
                                                    const char 
 host_name[],
                                                    int encode,
                                                    int address_family,
                                                    const char
 *(secondary_host_names[]),
                                                    size_t size)
 {


 Compile output:
dmc -Ar -ND -g -Ic:\ace\latest\ace_wrappers -DACE_NO_INLINE -Ic:\ace\ latest\ace_wrappers
  -DACE_HAS_ACE_TOKEN -DAC
 E_HAS_ACE_SVCCONF -DACE_BUILD_DLL  -c  -o .shobj/Multihomed_INET_Addr.o
 Multihomed_INET_Addr.cpp
 Multihomed_INET_Addr.cpp:
                            const char *(secondary_host_names[]) = 0,
                                                             ^
 c:\ace\latest\ace_wrappers\ace/Multihomed_INET_Addr.h(53) : Error:
parameter
 list is out of context
            const char *(secondary_host_names[]) = 0,
                                             ^
 c:\ace\latest\ace_wrappers\ace/Multihomed_INET_Addr.h(96) : Error:
parameter
 list is out of context
                                                    const char
 *(secondary_host_names[]),

         ^
 Multihomed_INET_Addr.cpp(30) : Error: ')' expected to close function
 parameter list with
                                                    size_t size){
                                                              ^
 Multihomed_INET_Addr.cpp(31) : Error: 'size_t' previously declared as
 something else
 It was declared as: unsigned
 It is now declared: int
   if (secondary_host_names && size){
    ^
 Multihomed_INET_Addr.cpp(37) : Error: '=', ';' or ',' expected
 Fatal error: too many errors
 --- errorlevel 1
 make[1]: *** [.shobj/Multihomed_INET_Addr.o] Error 1
 make[1]: Leaving directory `/cygdrive/c/ACE/latest/ACE_wrappers/ace'
 make: *** [ACE] Error 2

 C:\ACE\latest\ACE_wrappers\ace>
Oct 20 2004
parent reply "Walter" <newshound digitalmars.com> writes:
"Johnny Willemsen" <jwillemsen remedy.nl> wrote in message
news:cl63mg$d1$1 digitaldaemon.com...
 Hi Walter,

 The workaround you gave works, removing the identifier from the
declaration
 resolves these errors, but this is not the way I like to go. I think this
is
 a small bug in the DMC compiler, do you agree?
I've added it to the bug list.
Oct 20 2004
parent reply "Johnny Willemsen" <jwillemsen remedy.nl> writes:
Hi Walter

 I've added it to the bug list.
Thanks, I will then wait for a newer version Johnny
 
Oct 20 2004
parent reply "Walter" <newshound digitalmars.com> writes:
"Johnny Willemsen" <jwillemsen remedy.nl> wrote in message
news:cl6dhr$auc$1 digitaldaemon.com...
 Hi Walter

 I've added it to the bug list.
Thanks, I will then wait for a newer version
Why not just use the workaround and move on?
Oct 21 2004
parent reply "Johnny Willemsen" <jwillemsen remedy.nl> writes:
Hi,

 Hi Walter

 I've added it to the bug list.
Thanks, I will then wait for a newer version
Why not just use the workaround and move on?
The issue is that when I just remove it in ACE the doxygen documentation isn't generated completely and I don't want to zap this just for DMC. I will continue porting and change this on the build system, but not in cvs. Johnny
Oct 21 2004
parent "Walter" <newshound digitalmars.com> writes:
"Johnny Willemsen" <jwillemsen remedy.nl> wrote in message
news:cl8roi$o2b$1 digitaldaemon.com...
 Hi,

 Hi Walter

 I've added it to the bug list.
Thanks, I will then wait for a newer version
Why not just use the workaround and move on?
The issue is that when I just remove it in ACE the doxygen documentation isn't generated completely and I don't want to zap this just for DMC. I
will
 continue porting and change this on the build system, but not in cvs.
You can wrap the identifier with #ifndef __DMC__ ... #endif.
Oct 21 2004