C++ Logo

std-discussion

Advanced search

Re: constexpr functions and variables

From: Thiago Macieira <thiago_at_[hidden]>
Date: Wed, 03 Apr 2024 11:26:51 -0700
On Wednesday 3 April 2024 05:52:43 PDT Federico Kircheis via Std-Discussion
wrote:
> The question is if something similar was considered for functions,
> because there are similar advantages

constexpr functions are implicitly inline. Therefore, you MUST see the body in
order to call them. We don't have extern inline like C does. It seems to me
that to have what you're requesting, this is what you need to focus on first.

I mean, extern inlines compile, but they does not do what they do in C, which
is to emit an out-of-line non-weak/non-mergeable copy of the function. Compare
https://c.godbolt.org/z/Y4xebq4PE to https://gcc.godbolt.org/z/cx5qorn5T

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

Received on 2024-04-03 18:26:54