C++ Logo

std-proposals

Advanced search

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

From: Jason McKesson <jmckesson_at_[hidden]>
Date: Sun, 27 Apr 2025 10:46:42 -0400
On Sun, Apr 27, 2025 at 10:42 AM Tiago Freire <tmiguelf_at_[hidden]> wrote:
>
> > By the rules of C++, if you test the addresses of these two objects, they *must* be different.
>
> Again why? I know that is what it does now, but why is it important to behave this way?

Why do you want different things to pretend they're the same thing? If
you want the language to be changed, you need to offer a reason why it
would be good, not simply "why not".

> > Because they have different names which
> denote different entities *even if* the result of evaluating them is known by the compiler to be the same.
>
> Why would that matter?

Because the language is supposed to actually make sense. If you want
two different declarations with different names to denote the same
entity... shouldn't the user actually, *explicitly* request that? What
even is a declaration or a name if it doesn't represent a specific,
distinct entity?

We have a way to create a name that denotes an existing (object)
entity: references. But they don't happen behind the user's back;
there's special syntax for creating them.

Received on 2025-04-27 14:46:55