Thread overview | ||||||
---|---|---|---|---|---|---|
|
March 11, 2004 invalid simple type name destructor | ||||
---|---|---|---|---|
| ||||
Could anybody tell me what this error means exactly? I can't find it in the documentation on the site. Regards, Remko van der Vossen. |
March 11, 2004 Re: invalid simple type name destructor | ||||
---|---|---|---|---|
| ||||
Posted in reply to Wichetael | Ah, I found the error, apparently I left an empty set of parenthesis, where there had been a variable initialization. But is it really false C++ to have an empty set of parenthesis in a variable declaration? Also, I still don't get what the error is trying to tell me, and why is it not included in the on-line documentation? Regards, Remko van der Vossen "Wichetael" <wichetael@gmx.net> wrote in message news:c2q22g$2tnt$1@digitaldaemon.com... > Could anybody tell me what this error means exactly? I can't find it in the > documentation on the site. > > Regards, Remko van der Vossen. > > |
March 12, 2004 Re: invalid simple type name destructor | ||||
---|---|---|---|---|
| ||||
Posted in reply to Wichetael | Hello,
Wichetael wrote...
> Ah, I found the error, apparently I left an empty set of parenthesis, where there had been a variable initialization. But is it really false C++ to have an empty set of parenthesis in a variable declaration?
if you have
struct XYZ {
XYZ() {}
~XYZ() {}
};
and write a variable definition as
XYZ variable(); // parenthesis here!
then the compiler will not interpret this as a variable definition but
as a function declaration (variable is a function taking no arguments
and returning a XYZ).
To define a variable the parenthesis must be taken away.
- Heinz
|
March 16, 2004 Re: invalid simple type name destructor | ||||
---|---|---|---|---|
| ||||
Posted in reply to Heinz Saathoff | Of course, doh... Thanks anyway, Remko van der Vossen. "Heinz Saathoff" <hsaat@bre.ipnet.de> wrote in message news:MPG.1abbc008a9fc1a5f9896da@news.digitalmars.com... > Hello, > > Wichetael wrote... > > Ah, I found the error, apparently I left an empty set of parenthesis, where > > there had been a variable initialization. But is it really false C++ to have > > an empty set of parenthesis in a variable declaration? > > if you have > > struct XYZ { > XYZ() {} > ~XYZ() {} > }; > > and write a variable definition as > > XYZ variable(); // parenthesis here! > > then the compiler will not interpret this as a variable definition but > as a function declaration (variable is a function taking no arguments > and returning a XYZ). > To define a variable the parenthesis must be taken away. > > > - Heinz |
Copyright © 1999-2021 by the D Language Foundation