c++ - Const error should be warning ??
- Matthew Wilson (20/20) Sep 22 2002 Not sure whether this should only be a warning (haven't mustered the eff...
- Walter (7/26) Sep 23 2002 effort
- Matthew Wilson (2/4) Sep 23 2002 In which case I prefer the DMC version. Helps me that bit more to valida...
Not sure whether this should only be a warning (haven't mustered the effort
to trawl the standard this early in the morning)
class X
{
public:
operator const char const * () const
{
return 0;
}
};
gives
Error: ...: illegal combination of types
I expected it to simply tell me that the first (or second) const was
superfluous.
I don't object to this one in its current form, but am concerned as to
whether it means that the compiler would balk in a template class defintion
where that template defines a member typedef an a constant type with which
it is parameterised, and the parameterising type is itself const. Borland
does have problems in this area.
Matthew
Sep 22 2002
"Matthew Wilson" <dmd synesis.com.au> wrote in message news:amlfgi$p8$1 digitaldaemon.com...Not sure whether this should only be a warning (haven't mustered theeffortto trawl the standard this early in the morning) class X { public: operator const char const * () const { return 0; } }; gives Error: ...: illegal combination of types I expected it to simply tell me that the first (or second) const was superfluous.I believe the standard says it's supposed to be an error, just like short short is an error, and short int short is an error.I don't object to this one in its current form, but am concerned as to whether it means that the compiler would balk in a template classdefintionwhere that template defines a member typedef an a constant type with which it is parameterised, and the parameterising type is itself const. Borland does have problems in this area.This should work fine.
Sep 23 2002
I believe the standard says it's supposed to be an error, just like short short is an error, and short int short is an error.In which case I prefer the DMC version. Helps me that bit more to validate the code.
Sep 23 2002








"Matthew Wilson" <dmd synesis.com.au>