Re: [AD] constness in ugetx()

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Tue, Nov 14, 2000 at 12:21:01PM +0100, Sven Sandberg wrote:
> There's a small problem with the constness in ugetx() which I don't
> think has been discussed yet. Constness for double pointer parameters,
> like the parameter in ugetx(const char **c), works in a slightly
> unexpected way: You can't pass a non-const `char **' to it. This is
> because inside ugetx() it is allowed to do eg:
> 
>    *x = "hello world";
> 
> (where "hello world" is a `const char *'), in which case the non-const
> `char **' in the calling function would end up pointing to a `const char
> **'.

Can't you make it ugetx(char const **c)?  I don't know much about 
`const', but I think that makes the chars are not const, the outer 
pointer is, and the inner pointer is not.

George



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/