Article View: comp.std.c++
Article #1427Re: Type System
From: Patrick Smith
Date: Fri, 08 Jan 1993 07:32
Date: Fri, 08 Jan 1993 07:32
26 lines
1212 bytes
1212 bytes
jss@lucid.com (Jerry Schwarz) writes:
|The way I understand it, when an object is created (constructed)
|it can be "marked" as mutable or immutable. ("Marked" in quotes
|because no runtime marking is implied). This mark cannot be
|changed. The type system is designed so that (barring the
|use of unsafe casts) the following rule is assured.
|
| If an lvalue has non-const type,
| then it refers to a mutable object.
There is another loophole. :-(
But it's (I hope) an unusual type of situation. :-)
struct A { A(); /*...*/ };
A* pa;
A::A { pa = this; }
void f() {
const A a;
// Now pa has non-const type but points to an immutable object.
}
--
Patrick Smith
uunet.ca!frumious!pat
pat%frumious.uucp@uunet.ca
Technical Details
Message-ID:
<C0Iy9o.9x@frumious.uucp>Path:
arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!spool.mu.edu!wupost!zaphod.mps.ohio-state.edu!uunet.ca!frumious!patReferences:
<1993Jan1.172044.9659@ucc.su.OZ.AU> <1993Jan4.194318.5340@lucid.com>Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c++ Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!spool.mu.edu!wupost!zaphod.mps.ohio-state.edu!uunet.ca!frumious!pat From: pat@frumious.uucp (Patrick Smith) Subject: Re: Type System Message-ID: <C0Iy9o.9x@frumious.uucp> Date: Fri, 8 Jan 1993 07:32:11 GMT Reply-To: uunet.ca!frumious!pat References: <1993Jan1.172044.9659@ucc.su.OZ.AU> <1993Jan4.194318.5340@lucid.com> Organization: None Lines: 26