API : constness ?
Delaney, Timothy C (Timothy)
tdelaney at avaya.com
Mon May 31 02:03:57 EDT 2004
Benoît Dejean wrote:
> Le Mon, 31 May 2004 11:56:57 +1000, Delaney, Timothy C (Timothy) a
> écrit :
>
>> Benoît Dejean wrote:
>
>>> static const char * const kwlist[] = { "uri", "open_mode",
>>> "exclusive", "perm", NULL };
>>
>> Does this give any performance or size improvement?
>
> of course, it avoids a lot of relocation, reduces load time, and
> manque the compiler to make further informations because data will be
> in a readonly segment. it is safe to apply this kind of change to
> static data.
I hope it does work out that there are improvements (anything to stop Guido getting a pie in the face ;) but I also expect those improvements to be marginal. Hope I'm wrong :) I was just wondering how smart GCC (and MSVC) are about this.
As you state, the real value of this would be to extension writers not having to cast (and hence having cleaner code).
> my first goal is const correctness, i don't know if i can show
> something. it will just remove warnings and move data to the text
> segment, etc
Anything that gets rid of warnings *correctly* is IMO a Good Thing(TM).
Tim Delaney
More information about the Python-list
mailing list