C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Floating an idea: [[no_address]] for functions.

From: Bo Persson <bo_at_[hidden]>
Date: Mon, 24 Mar 2025 07:34:26 +0100
On 2025-03-24 at 06:32, Jan Schultke via Std-Proposals wrote:
> I like the idea in principle, but a proposal would have to figure out
> many nuanced issues.
>
> Firstly, attributes are ignorable, and perhaps, we would want a
> program to be straight up ill-formed if it takes the address of a
> function we've marked as non-addressable. I don't see a compelling
> reason to keep this an attribute. Rather, a contextual keyword like
> the following makes sense:
>
>> void f() no_address;

This seems like a place where C++ could get the wrong defaults (as
usual?). Wouldn't it be better to have an "addressable" keyword for
those few standard functions that are addressable?

Received on 2025-03-24 06:34:36