🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #228

Re: casting "const" to "non-const"

#228
From: Karl Heuer
Date: Wed, 01 Aug 1990 23:05
14 lines
1312 bytes
In article <GLENN.90Aug1145326@huxley.bitstream.com> <glenn@bitstream.com> (Glenn Parker) writes:
>Const is not a typename, it is a storage qualifier, like "auto" and "static".

"int" is an atomic type.  "auto" is a storage class.  "const" is a type
qualifier.  The three are distinct concepts.

>I agree with Jim that you shouldn't be able to cast from const to non-const.

Seems to me that the ANSI C rules have it right: you can cast from const to
non-const if you have to, but you can't use the non-const pointer to modify an
object that's ultimately const.  The compiler could legally put a const object
into nonwritable store.

Karl W. Z. Heuer (karl@kelp.ima.isc.com or ima!kelp!karl), The Walking Lint
Technical Details
Message-ID: <17201@haddock.ima.isc.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!usc!sdd.hp.com!decwrl!bacchus.pa.dec.com!deccrl!decvax.dec.com!ima!haddock!karl
References: <56159@microsoft.UUCP> <56163@microsoft.UUCP> <1913@ux.acs.umn.edu> <GLENN.90Aug1145326@huxley.bitstream.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!usc!sdd.hp.com!decwrl!bacchus.pa.dec.com!deccrl!decvax.dec.com!ima!haddock!karl
From: karl@haddock.ima.isc.com (Karl Heuer)
Newsgroups: comp.std.c++
Subject: Re: casting "const" to "non-const"
Message-ID: <17201@haddock.ima.isc.com>
Date: 1 Aug 90 23:05:08 GMT
References: <56159@microsoft.UUCP> <56163@microsoft.UUCP> <1913@ux.acs.umn.edu> <GLENN.90Aug1145326@huxley.bitstream.com>
Reply-To: karl@haddock.ima.isc.com (Karl Heuer)
Distribution: comp
Organization: Interactive Systems, Cambridge, MA 02138-5302
Lines: 14