Article View: comp.std.c++
Article #694Re: implicit pointer of pointer argument promotion legal C++?
From: Andrew Koenig
Date: Fri, 09 Oct 1992 14:14
Date: Fri, 09 Oct 1992 14:14
28 lines
1339 bytes
1339 bytes
In article <23842@alice.att.com>, I wrote: > Converting T** to const T** had better not be legal in C++, because if > it were, it would open a hole in the type system that would allow modification > of genuinely constant objects. I suppose I should give an example: const char x = '*'; char* p; Now, if we could make p point at x, that would be bad news because we could then change the value of x even though it is a const object. Well, if we can do this: const char** q = &p; (which is illegal, but would be legal if conversions from T** to const T** existed), then we would be able to do this: *q = &x; which would effectively make p point at x. All the other operations here are unquestionably legal, which means we must rule out the declaration of q. -- --Andrew Koenig ark@europa.att.com
Technical Details
Message-ID:
<23849@alice.att.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!portal!lll-winken!sol.ctr.columbia.edu!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!att!allegra!alice!arkReferences:
<1992Oct8.162653.12028@urbana.mcd.mot.com> <23842@alice.att.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!portal!lll-winken!sol.ctr.columbia.edu!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!att!allegra!alice!ark From: ark@alice.att.com (Andrew Koenig) Newsgroups: comp.std.c++ Subject: Re: implicit pointer of pointer argument promotion legal C++? Message-ID: <23849@alice.att.com> Date: 9 Oct 92 14:14:10 GMT References: <1992Oct8.162653.12028@urbana.mcd.mot.com> <23842@alice.att.com> Organization: AT&T Bell Laboratories, Murray Hill NJ Lines: 28