xeus-cling icon indicating copy to clipboard operation
xeus-cling copied to clipboard

Why printing an address `&x` do not work?

Open AtomicVar opened this issue 1 year ago • 1 comments

I tried to inspect the address of an variable x with:

int x = 42;
&x

It showed:

@0x7ffc383a5a88

But if I use printf to print the address, the result is different:

printf("&x=%p\n", &x)

It showed:

&x=0x7f69a0a6c0e0

If you create another int y and print its address with &y, it' the same with &x!

int y = 99;
&y

It showed:

@0x7ffc383a5a88

Seems like printing an address with &x is not working. Why?

AtomicVar avatar Mar 13 '23 14:03 AtomicVar

Thanks for reporting. I think we are missing an overload of mime renderer for pointers, and thus it print the address of an internal object.

JohanMabille avatar Mar 16 '23 11:03 JohanMabille