From -7978823006243329985
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,fc1538f2aa3fc9f8
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 1993-01-07 23:53:08 PST
Newsgroups: comp.std.c++
Path: 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

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


