(Ab)using pointers to const objects

Al Dunbar userAKDU at mts.ucs.UAlberta.CA
Wed Oct 17 13:36:36 AEST 1990


In article <1990Oct15.115003.29238 at micrognosis.co.uk>, nreadwin at micrognosis.co.uk (Neil Readwin) writes:
>I am trying to understand what I can do with pointers to const and non-const
>objects.  The VAX C manual (not much of a reference, I admit) says 'if you
>attempt to access a const object using a pointer to that object not declared
>const then the result is undefined'.
>
>I am uncertain whether 'not declared const' applies to 'object' or
>'pointer', but I assume it means 'object'.
>
 
I disagree. If it is a 'const object' then it must have been
declared so, otherwise it must be something other than a
const object. Ask a bunch of grammarians if 'not declared object'
refers to 'that object' or 'a pointer to that object', and I bet
the majority will answer 'a pointer to that object'. If any
grammarians E-mail me their opinions, I will post a summary to
the net (but only if I'm proved right, of course :-) ).
 
-------------------+-------------------------------------------
Al Dunbar          |
Edmonton, Alberta  |   this space for rent
CANADA             |
-------------------+-------------------------------------------
#! r



More information about the Comp.lang.c mailing list