bug-ddd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ddd/MString.h problems in 3.3 with Solaris C++ compiler, liberty ins


From: Arnaud Desitter
Subject: Re: ddd/MString.h problems in 3.3 with Solaris C++ compiler, liberty install problems
Date: Fri, 23 Feb 2001 14:45:22 +0000 ()

Hi,

> 
> I'm not sure about this: the Sun CC message explicitly stated that the
> `text' parameter was erroneous.  
> 
> Also, this change would have to be applied to the next N constructors
> as well (which didn't report any problems).
> 
> Finally, it risks to introduce new errors on systems where
> `XmStringCharSet' is not defined as a `char *' or `const char *'.
> 

My mistake ! To redeem myself, I provide a patch below that fixes
the problem. This may be due to an weird interaction between operator
overloading and default parameter.

> 
> > Note that it would be better to use "const_cast<char*>".
> 
> I'd love to.  But so far, DDD's C++ code still more or less compiles
> with very old C++ compilers (which, among others, do not support
> `const_cast'...)

I suppose one could use a macro CSTCAST(type,expr) and an associated
autoconf test. Not top priority, that's for sure.

Likewise, I recommend to get rid of "operator char*() const;" in 
strclass.h and to use "const char* chars() const;" instead.

Cheers,
Arnaud


--- ddd-3.3/ddd/MString.h       Fri Feb 23 14:28:34 2001
+++ ddd-3.3-1/ddd/MString.h     Mon Dec 11 12:21:47 2000
@@ -52,12 +52,7 @@
 
 public:
     // Constructors
-    MString():
-       _mstring(XmStringCreateLtoR((char*)"", MSTRING_DEFAULT_CHARSET) )
-    {
-       assert(OK());
-    }
-    MString(const char *text ,
+    MString(const char *text = "",
            XmStringCharSet charset = MSTRING_DEFAULT_CHARSET):
        _mstring(text ? XmStringCreateLtoR((char *)text, charset) : 0)
     {



reply via email to

[Prev in Thread] Current Thread [Next in Thread]