Path: utzoo!attcan!uunet!husc6!cmcl2!adm!smoke!gwyn From: gwyn@smoke.ARPA (Doug Gwyn ) Newsgroups: comp.lang.c Subject: Re: const comparison in C and C++ Message-ID: <8529@smoke.ARPA> Date: 19 Sep 88 02:28:44 GMT References: <709@paris.ICS.UCI.EDU> <8500@smoke.ARPA> <1411@solo3.cs.vu.nl> <8516@smoke.ARPA> <785@proxftl.UUCP> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB)) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 20 In article <785@proxftl.UUCP> bill@proxftl.UUCP (T. William Wells) writes: >In article <8516@smoke.ARPA> gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) writes: >: void copy(const char *source, char *destination, unsigned count); >: ... modification of any storage validly accessible via >: the second parameter is NOT prohibited. >Sorry Doug, it's undefined. Sorry yourself, it's the way I stated. >"If an attempt is made to modify an object defined with a >const-qualified type through use of an lvalue with >non-const-qualified type, the behavior is undefined." This is simply not relevant. The parameter declarations do not define objects. So long as the object being block-moved into does not have the "const" attribute, it can be modified. The point is that a pointer-to-const can ALSO be used to refer to such a non-const object, but it cannot be used to modify the object.