Path: 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> Reply-To: karl@haddock.ima.isc.com (Karl Heuer) Distribution: comp Organization: Interactive Systems, Cambridge, MA 02138-5302 Lines: 14 In article (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