Date: Fri, 2 May 2025 17:02:39 +0000
In many build flows, linking is quite separate from compilation. Addresses are very OS specific, users can also provide custom linker scripts etc. The compiler has no clue what addresses will be used in such a scenario: addresses are only assigned at link or load time. Even if you could give the compiler a range of addresses the linker won’t touch (it would have to be some compiler option, as the linker and loader might use anything), it won’t allow you to compare addresses not assigned until link time or later: dynamic loaded libraries are only allocated at load time, possibly at very random addresses for security. Another example: in some embedded systems, selected critical functions are placed in fast memories, far from main memory. Also, some systems have code at both lowest and highest addresses, so the compiler can’t be given a valid address range that is always greater or lesser than unassigned addresses. And of course, there are many scenarios where one expects to be able to build an object file or library that can be used in any system (with totally unpredictable address assignments).
Filip via Std-Proposals wrote:
* Maybe a stupid question but aren’t pointers just numbers and as such should be comparable?
*
* And during compilation wouldn’t it basically always be the order of compilation of this functions that is being tested by < ?
Filip via Std-Proposals wrote:
* Maybe a stupid question but aren’t pointers just numbers and as such should be comparable?
*
* And during compilation wouldn’t it basically always be the order of compilation of this functions that is being tested by < ?
Received on 2025-05-02 17:02:46