This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Strung class 'copy' method not const (as in ANSI C++)
- To: egcs-bugs at cygnus dot com
- Subject: Strung class 'copy' method not const (as in ANSI C++)
- From: Graham Hudspith <ghudspit at mltsa dot uk dot lucent dot com>
- Date: Sat, 06 Dec 1997 11:10:07 +0000
- Organization: Lucent Technologies
Dear EGCS,
Built and installed:
gcc version egcs-2.90.21 971202 (egcs-1.00 release)
on both hppa1.1-hp-hpux10.20 and sparc-sun-sunos4.1.3_U1. Very
clean build and install, especially with 'make bootstrap'!
Some of our existing source code, which was happily compiling
using g++/c++ v2.7.2.1 with ObjectSpace's STL v1, now fails to
compile with egcs. This is not unexpected! However, one problem
identified concerns the 'string' class that comes with egcs.
The 'copy' method is defined in egcs' std/bastring.h as:
size_type copy (charT* s, size_type n, size_type pos = 0);
when, according to the ANSI C++ draft (Dec 1996), it should be
something along the lines of:
size_type copy (charT* s, size_type n, size_type pos = 0) const;
This knackers our own classes which contain string data members
where the class methods have been marked as const themselves.
Of course, I can temporarily get around this by making the
string data members mutable, but it leaves a nasty taste in
the mouth!
Regards,
Graham.
--
Graham Hudspith, Transmission Dev Group, | Email:
graham.hudspith@lucent.com
Lucent Technologies Network Systems (UK),|
Swindon Road, Malmesbury, |
Wiltshire SN16 9NA, UK. | Phone: +44 1666 832372/822861