A question on modification of a list via a function invocation

Gregory Ewing greg.ewing at canterbury.ac.nz
Thu Sep 7 09:37:25 EDT 2017


Steve D'Aprano wrote:
> I think that these two increment procedures will be (more or less?) equivalent:
> 
> procedure increment(var n: integer);
>   begin
>     n := n + 1
>   end;
> 
> procedure increment2(p: intpointer);
>   begin
>     p^ := p^ + 1
>   end;

They are, with the proviso that, in standard Pascal, increment2
can only be applied to a heap-allocated instance of intpointer,
whereas increment can be applied to any variable of type
integer.

-- 
Greg



More information about the Python-list mailing list