Thread View: gnu.g++.lib.bug
2 messages
2 total messages
Started by Gilligan
Fri, 02 Feb 1990 14:50
possible bug in the Plex generic
Author: Gilligan
Date: Fri, 02 Feb 1990 14:50
Date: Fri, 02 Feb 1990 14:50
54 lines
2070 bytes
2070 bytes
If there is a known bug involving header/implementation
mismatch (`const' .vs. no `const') with the Plex class under
libg++-1.36.3, ignore me.
Has anyone noticed a problem with the libg++-1.36.3 Plex generic
class? I pulled the new libg++ off of prep a few days ago and
installed it. I was recently using it with one of my own classes and
I got an error (something like "argument list does not match in any
class definition" ). After a good night's sleep I noticed that the
prototypes in the .h file were different from the implementation in
the .cc file to the tune of a `const' or two. What follows are my
diffs to Plex that made it work.
I've noticed that a lot of the classes have been sprouting `const's
left and right. Good job! Koenig said that this was one of the
things that no one tells you, but is almost necessary for good code.
Someone may want to check the rest of the classes for missing `const's
(header and code mismatch that is).
*** Plex.ccP Fri Dec 1 08:24:10 1989
--- /local/lib/gnu/g++-include/Plex.ccP Fri Feb 2 09:16:30 1990
***************
*** 153,164 ****
}
! void <T>Plex::fill(<T&> x)
{
for (int i = lo; i < fnc; ++i) (*this)[i] = x;
}
! void <T>Plex::fill(<T&> x, int lo, int hi)
{
for (int i = lo; i <= hi; ++i) (*this)[i] = x;
}
--- 153,164 ----
}
! void <T>Plex::fill(const <T&> x)
{
for (int i = lo; i < fnc; ++i) (*this)[i] = x;
}
! void <T>Plex::fill(const <T&> x, int lo, int hi)
{
for (int i = lo; i <= hi; ++i) (*this)[i] = x;
}
--
( My name's not really Gilligan, It's Robert Forsman, without an `e' )
possible bug in the Plex generic
Author: Doug Lea
Date: Sat, 03 Feb 1990 12:54
Date: Sat, 03 Feb 1990 12:54
18 lines
1273 bytes
1273 bytes
Thanks. `fill' was mismatched in all the *Plex files. Sorry. Fixed
for next release.
> I've noticed that a lot of the classes have been sprouting `const's
> left and right. Good job! Koenig said that this was one of the
> things that no one tells you, but is almost necessary for good code.
> Someone may want to check the rest of the classes for missing `const's
> (header and code mismatch that is).
Most libg++ classes have been thoroughly const-ified. Occasionally
this creates anomolies in order to be sufficiently conservative. For
example, you cannot perform s.before("x") for a const String s, since
the resulting SubString might modify s. This is true even if you only
want to read, not change the SubString. There are several other such
cases.
-Doug
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads