[issue1302] Fixes for profile/cprofile

Alexandre Vassalotti report at bugs.python.org
Fri Oct 26 02:19:29 CEST 2007


Alexandre Vassalotti added the comment:

> I still don't understand why you are using (sizeof lower) - 2 

It is simply to avoid duplicating the constant (a.k.a. the Don't Repeat
Yourself (DRY) rule).

> and what &lower[(sizeof lower) - 2] returns. Is it the memory address
> of lower[17]?

It the address of lower[18] to be exact. (l < &lower[(sizeof lower) -
2]) is simply tricky notation to check the bound of the array.
Personally, I used like to subtract pointer, ((lower - l + 1) < (sizeof
lower)) to get the bound. But now, I find Guido's trick more cute (and
less error-prone). :)

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1302>
__________________________________


More information about the Python-bugs-list mailing list