Alan,

At 10:51 AM 8/26/99 -0500, you wrote:
>This is EXACTLY what I want. dataP is a pointer to the data I want to 
>access READ-ONLY; thus I WANT the compiler to prevent me from 
>modifying *dataP. For instance, in memory, there is:
>
>0x0010 "Alan Pinstein"
>
>
I think you misunderstood me, which is not surprising given the difficulty
I'm having explaining myself.

Let me try again - you want a pointer to a pointer to constant memory.  In
other words, given the example above, let's say I have a function that
assigns the address of that memory to a void ptr out-param:

void GetAlansName(void ** dataP)
{
   (*dataP) = (void*) "Alan Pinstein";
}

So far, so good.  But you want to make sure that noone will ever change the
value of "Alan Pinstein", right?  And you'd like the compiler to enforce
this.  In this case, you want:

void GetAlansConstName (void const** dataP)
{
   (*dataP) = (void const *) "Alan Pinstein";
}

The declaration I mentioned (void * const *) was an example of what you did
not want.  Sorry it was not clear.  I believe this declaration should work
- let me know.

Greg

Greg Winton
Bachmann Software and Services, LLC
mailto:[EMAIL PROTECTED]
http://www.bachmannsoftware.com
Software Development for Handheld & Mobile Computing, Windows and the Internet
Home of Bachmann Print Manager, the only graphical printing solution for
the Palm Computing Platform

Reply via email to