On Wed, Sep 6, 2017 at 5:48 AM, Stefan Ram <r...@zedat.fu-berlin.de> wrote:
>   Depends on the meaning of "meaningful". In Java, one can
>   inspect and manipulate pointers like in this program for
>   example:
> [chomp code]

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:

#include <stdio.h>
void do_stuff(int *x)
{
    printf("x (%p) points to %d\n", x, *x);
    x += 2;
    printf("Now x (%p) points to %d\n", x, *x);
}
int main()
{
    int x[3] = {28, 42, 79};
    do_stuff(x); /* or do_stuff(&x[0]); */
    return 0;
}

You can't do this with Python, since pointer arithmetic fundamentally
doesn't exist. You can in C. Can you in Java?

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to