C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Guarantees over addresses from function pointers created from lambda

From: Thiago Macieira <thiago_at_[hidden]>
Date: Fri, 02 May 2025 06:56:47 -0700
On Friday, 2 May 2025 01:20:29 Pacific Daylight Time Filip via Std-Proposals
wrote:
> Maybe a stupid question but aren’t pointers just numbers and as such should
> be comparable?

No, they aren't, not always anyway. In theory, pointers could be composed of
more than one numeric component. Think of your complex number theory: which
one is smaller, 1 + i or 1 - i ?

They in theory and in practice during compilation composed of non-numbers.

> And during compilation wouldn’t it basically always be the order of
> compilation of this functions that is being tested by < ?

What order? Who said that the order of functions in the output is specified by
the compiler? In some platforms, including and especially MSVC, each function
is in a separate section, so the *linker* chooses the order.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Principal Engineer - Intel DCAI Platform & System Engineering

Received on 2025-05-02 13:56:55