On Wed, 06 Sep 2017 01:04:17 +0300, Marko Rauhamaa wrote:

> Chris Angelico <ros...@gmail.com>:
> 
>> That shows that the Java '==' operator is like the Python 'is'
>> operator, and checks for object identity. You haven't manipulated
>> pointers at all. In contrast, here's a C program that actually
>> MANIPULATES pointers:
>>
>> [...]
>>
>> You can't do this with Python, since pointer arithmetic fundamentally
>> doesn't exist. You can in C. Can you in Java?

A necessary (but not sufficient) condition to be able to do pointer 
arithmetic is to actually have pointers as a data type.

Pointers are not a data type in either Python or Java, so of course you 
can't do pointer arithmetic on them. If you don't have a pointer, you 
can't do arithmetic on it.

Pointer arithmetic itself is not the issue. Java could have been like 
standard Pascal, and allow pointers as a first class data type (you can 
assign them to variables, pass them to functions, return them, have 
pointers to pointers, etc) without allowing pointer arithmetic. But they 
didn't -- Java the language doesn't include pointers as a value at all.

 
> You can't do it in Pascal, either, but Pascal definitely has pointers.

Not in standard Pascal, but most actual Pascal compilers let you perform 
pointer arithmetic.




-- 
Steven D'Aprano
“You are deluded if you think software engineers who can't write 
operating systems or applications without security holes, can write 
virtualization layers without security holes.” —Theo de Raadt
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to