API : constness ?

Erik Max Francis max at alcyone.com
Tue Jun 1 02:36:38 EDT 2004


Andrea Griffini wrote:

> This may sound terrible, but indeed the data that a
> "pointer to constant" is pointing to is not (in general)
> constant. Being a "pointer to constant" is a property of
> the *pointer*, not of the *pointed data*.
> 
> Const pointers in interfaces are designed to be an help
> for the (distracted) programmers, they can't be an help
> for the compiler.

To his credit, he was talking about declaring an array of strings as
const char *const.  That is, he was indeed making the data he was
passing in truly const.  As others have pointed out, though, that
doesn't guarantee that that data will be put in read-only memory, only
that it makes it possible.

-- 
 __ Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
/  \ San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis
\__/ When you talk to her / Talk to her
    -- India Arie



More information about the Python-list mailing list