Re: How to force gcc to blackhole registers so that things maybe garbage collected?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 22 May 2019, Hamad Ahmed wrote:

>  As an example,
> the C standard disallows casting a pointer to an int,
> doing operations on the int, and then casting back to a pointer.

Not true; if the int is sufficiently wide so that pointer representation
is not truncated, if after your operations you got back the same int, you're
guaranteed that casting back to a pointer results in the original pointer.

Moreover, in C you can write a pointer representation into a file using
printf("%p"), then some time later read it back from that file using
scanf("%p"), and you'll get back the original pointer.  Of course between
the printf and the scanf said pointer value might not exist in the address
space of your program at all.

Alexander



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux