| Deutsch English Français Italiano |
|
<vgj3n1$2pbqp$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder2.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Thiago Adams <thiago.adams@gmail.com>
Newsgroups: comp.lang.c
Subject: clang and gcc are not converging on constexpr
Date: Thu, 7 Nov 2024 16:16:49 -0300
Organization: A noiseless patient Spider
Lines: 20
Message-ID: <vgj3n1$2pbqp$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 07 Nov 2024 20:16:50 +0100 (CET)
Injection-Info: dont-email.me; posting-host="92004c3695555ecdb13cc05ab26d8707";
logging-data="2928473"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/GttWjUAdpjsUr6+cwMoobF6ji22Yvnqc="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:dDM15UhjRuD/JraQQD1F8pE9vHU=
Content-Language: en-US
Bytes: 1340
The differences relate to arrays. I think the standard leaves some
flexibility in the specification, so there may not be a strict right or
wrong - just different approaches. The challenge for creating portable
code is knowing when it will work consistently across different compilers.
Sample
int main() {
constexpr int a[] = {1, 2};
static_assert(a[0] == 1);
}
works in clang but not in gcc