> a pointer to a const-unsigned-char-pointer is not the same as
> a pointer to an unsigned-char-pointer
>
> It isn't even default convertable to one. You need to read up on
> the meaning of the keyword "const" in C++ in Scott Meyers' and
> Herb Sutter's books (and so do I.)
I don't think of what I have as a
pointer-to-const-unsigned-char-pointer.
I was thinking of it as a const-pointer-to-pointer-to-unsigned-char.
If that makes any sense.
What would be the best way to define an unsigned char ** to be read-only
then? (So that I could pass an unsigned char ** without problems)

Signature
gbeggs@Canada.com http://www3.sympatico.ca/~gbeggs/
Miro Jurisic - 11 Jul 2003 06:26 GMT
> I don't think of what I have as a
> pointer-to-const-unsigned-char-pointer.
[quoted text clipped - 4 lines]
> What would be the best way to define an unsigned char ** to be read-only
> then? (So that I could pass an unsigned char ** without problems)
Read it right to left.
char *
pointer to char
char const *
pointer to constant character
const char *
pointer to character constant == char const *
char * const
constant pointer to character
char const * const
constant pointer to constant character
const char * const
constant pointer to character constant == char const * const
char * *
pointer to pointer to character
char const * *
const char * *
pointer to pointer to constant character
char * const *
pointer to constant pointer to character
char * * const
constant pointer to pointer to character
char const * const *
const char * const *
pointer to constant pointer to constant character
char const * * const
const char * * const
constant pointer to pointer to constant character
char * const * const
constant pointer to constant pointer to character
char const * const * const
const char * const * const
constant pointer to constant pointer to constant character
conar char * volatile & const
constant reference to volatile pointer to constant character
You get the idea.
So, if you want const pointer to pointer to unsigned char, you want
unsigned char * * const
However, that's almost certainly not what you mean, because you probably mean a
pointer to a const pointer to unsigned char. "const pointer" means the pointer
itself can't change, whereas I suspect you mean "pointer to const" which means
that the pointee can't change, so that would be
unsigned char * const *
hth
meeroh
Gerry - 11 Jul 2003 06:56 GMT
> You get the idea.
>
[quoted text clipped - 8 lines]
>
> unsigned char * const *
Wow Thanks :)
That's a bit of an eye opener.
I've always found the way C defines types a bit confusing when it gets
beyond the trivial.

Signature
gbeggs@Canada.com http://www3.sympatico.ca/~gbeggs/