Re: [AD] constness in ugetx()

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


On Wed, Nov 15, 2000 at 05:14:47PM +0100, Sven Sandberg wrote:
> Now, the problem in our case is that if you pass a non-const `char **'
> to ugetx(), the resulting pointer in the calling function will also be a
> non-const `char **', but if you pass it a `const char **' the resulting
> pointer in the calling function will still be a `const char **'. I.e. if
> the characters of the string were read-only, they will continue to be so
> and otherwise they will continue to be writable. However, the compiler
> can't be told that it works this way using the `const' keyword.

I don't see the problem though -- whatever pointer you pass the
address of, none of those routines alter the string it points
to, they just advance the pointer along the string.  Your last
email seemed to say that it does the equivalent of:

    *s = "Hello, world!";

but I can't find any code which tries this sort of thing.  `*s'
should never end up pointing at a different type (const or not)
of string than it started pointing at, because the only way it's
affected is through `(*s)++'.

Are you getting a specific warning, and if so, where?

George

-- 
Random project update:
22/06/2000: AllegroGL documentation:  http://allegrogl.sourceforge.net/
        See under `Documentation' for the AllegroGL Reference Manual in
        various formats.



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