Hacker News new | past | comments | ask | show | jobs | submit login

Actually no, the C abstract machine is not contiguous. If x and y point inside distinct objects (recursively) not part of the same object, there is no valid c that you can add to x to reach y.

edit: allowing that would prevent even basic optimizations like register allocation.

edit: s/virtual/abstract/




The C abstract machine requires reversible transformations from pointer to integral types (7.18.1.4 in C99, 3.3.4 in C90, the first ISO standard).

Practically speaking modern devices are in fact mostly flat, so you can of course do this, although you do brush up against undefined behavior to get there.


Reversible transformations don't imply a flat address space. All it means is that there's an integral type with enough bits to record any address in them.


Pointer provenance is more complex and subtle.


What is the c virtual machine? I thought there wasn't one


They mean the abstract machine, in terms of which the semantics are defined.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: