A question on modification of a list via a function invocation

Grant Edwards grant.b.edwards at gmail.com
Tue Sep 5 18:29:45 EDT 2017


On 2017-09-05, Marko Rauhamaa <marko at pacujo.net> wrote:

> Pointer arithmetics is not an essential part of C. One could argue that
> it was a mistake to include it in the language.

One may argue that it was a mistake, but I remember at least one
implementation where pointer arithmetic was hugely more efficient than
indexing into arrays.  Incrementing a pointer through an array was
way, way faster than indexing through the array by incrementing an
array subscript.

But, that was 25 years ago on an 8-bit CPU where where integer
multiplies were expensive.  The last time I compare the two methods
with a recent GCC on a 32-bit CPU, it generated pretty much the same
code either way...

-- 
Grant Edwards               grant.b.edwards        Yow! Someone in DAYTON,
                                  at               Ohio is selling USED
                              gmail.com            CARPETS to a SERBO-CROATIAN




More information about the Python-list mailing list