🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

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

#219
From: Glenn P. Parker
Date: Wed, 01 Aug 1990 18:53
25 lines
1840 bytes
In article <1913@ux.acs.umn.edu> hopper@ux.acs.umn.edu (hopper) writes:
>In article <56163@microsoft.UUCP> jimad@microsoft.UUCP (Jim ADCOCK) writes:
>>Proposed:
>>
>>That when a parameter [including the hidden "this" parameter] is declared 
>>"const", or when the object referenced by a parameter is declared "const",
>>than it is not legal to modify that which is declared "const" within the 
>>function. This is to say, the trick of casting to a non-const does not 
>>work on a parameter declared as "const."  Compilers can flag as an error 
>>these situations.
>>
>	I don't agree with the illegalization of this construct. I think it
>is against the spirit of the language to illegalize a cast.

Until recently (after C++ invented it), C did not have "const".  Therein
lies some confusion.  I submit that it is absurd to put const in the same
category with other type names.  Const is not a typename, it is a storage
qualifier, like "auto" and "static".  You can't typecast from auto to
static, and I agree with Jim that you shouldn't be able to cast from const
to non-const.
--
--------------------------------------------------------------------------
Glenn P. Parker        Bitstream, Inc.
uunet!huxley!glenn     215 First Street
glenn@bitstream.com    Cambridge, MA 02142-1270
Technical Details
Message-ID: <GLENN.90Aug1145326@huxley.bitstream.com>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!huxley!glenn
References: <56159@microsoft.UUCP> <56163@microsoft.UUCP> <1913@ux.acs.umn.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!huxley!glenn
From: glenn@bitstream.com (Glenn P. Parker)
Newsgroups: comp.std.c++
Subject: Re: casting "const" to "non-const"
Message-ID: <GLENN.90Aug1145326@huxley.bitstream.com>
Date: 1 Aug 90 18:53:26 GMT
References: <56159@microsoft.UUCP> <56163@microsoft.UUCP> <1913@ux.acs.umn.edu>
Sender: glenn@huxley.UUCP
Reply-To: <glenn@bitstream.com> (Glenn Parker)
Distribution: comp
Organization: Bitstream, Inc.
Lines: 25
In-reply-to: hopper@ux.acs.umn.edu's message of 31 Jul 90 02:48:36 GMT