aspell-devel
[Top][All Lists]
Advanced

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

[aspell-devel] stings.hpp


From: James Lee
Subject: [aspell-devel] stings.hpp
Date: Fri, 16 Apr 2004 11:18:17 GMT

Hello,

I'm having problems with strings.hpp. Class String is now
(last few 0.60) declared as:

  class String : public OStream

In previous versions (0.50.5) it is:

  class String : public std::string, public OStream

This means that previously a call to operator== was serviced
by the std::sting class but now there is no operator defined
within the class.  Running a simple test program[1] through
ddd shows that gcc will implicitly type cast to a ParmString
then call operator==(ParmString s1, const char * s2).

Although by reading the comments I can see that this will give
the desire result I can't see from the coding why it should be.
It's also inefficient, even inlined.  More importantly the Sun
Forte compiler (Sun 1 Studio 8) doesn't assume the type cast
to ParmString.  If I provide the operator== methods in
string.hpp the Sun CC works but g++ finds an ambiguity.

Can the String classes be rationalised?  Why isn't the
std::string class used? Why don't the other string classes
inherit from String?



James Lee.




Note 1. Simple test program:

#include <string.hpp>

int
main(
        int argc,
        char argv[])
{
        acommon::String aaa = "aaa";

        if (aaa == "bbb") {
                exit(1);
        }

        exit(0);
}





reply via email to

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