[Date Prev][Date Next][Thread Prev][Thread Next][Author Index][Date Index][Thread Index]
michael/markm CONST treaty.
- To: <xtech>
- Subject: michael/markm CONST treaty.
- From: Michael McClary <michael>
- Date: Thu, 15 Nov 90 16:48:26 PST
Effective the next time my code is merged, and continuing until after
first release (or unless we figure out a way to fix this), const objects
are no longer allowed as descendents of Tofu, and the CONST macro expands
to the null string.
Programmers are welcome to continue using CONST on member functions where
appropriate, in case we can get it back (or can turn it back on for
frontend code). But they should be aware that the compiler will no longer
be checking for correctness. (Ick!)
Here's why:
- Some of the member functions in Heaper may cause shepherds to fault in.
Samples:
- isKindOf()
- getProxyCategory()
- These are member functions that should be callable for const objects
descended from Tofu, so they must be const.
- But because a conforming C++ compiler is allowed to make certain
optimizations (i.e. caching the result of isStub()), these functions,
in shepherds, must be non-const, or some compilers may produce broken
code. (This is why it can't just be overridden with a cast.)
- Further, even if we were to define a const and a non-const version:
- Some clients of these methods have no way to know, in advance,
which one to call.
- Code which conditionally calls a non-const member function of a
const object generates the compile-time error, even if it would
not actually call the function at run time.
Sigh.
michael