Похожие чаты

Main.C #Include <fenv.h> #include <stdio.h> int main(void) { constexpr float

f = 23.0f;
constexpr float g = 33.0f;
fesetround(FE_TOWARDZERO);
constexpr float h = f / g;
printf("%f\n", h);
}

I tried compiling this sample from cppreference(https://en.cppreference.com/w/c/language/constexpr) with the following command
gcc -std=c2x main.c -o main

But I'm getting error.
main.c: In function ‘main’:
main.c:6:5: error: ‘constexpr’ undeclared (first use in this function)
6 | constexpr float f = 23.0f;
| ^~~~~~~~~
main.c:6:5: note: each undeclared identifier is reported only once for each function it appears in
main.c:6:14: error: expected ‘;’ before ‘float’
6 | constexpr float f = 23.0f;
| ^~~~~~
| ;
main.c:7:14: error: expected ‘;’ before ‘float’
7 | constexpr float g = 33.0f;
| ^~~~~~
| ;
main.c:9:14: error: expected ‘;’ before ‘float’
9 | constexpr float h = f / g; // is not affected by fesetround() above
| ^~~~~~
| ;
main.c:10:20: error: ‘h’ undeclared (first use in this function)
10 | printf("%f\n", h);
| ^

I'm using gcc (Debian 12.2.0-14) 12.2.0.
constexpr is introduced in the C23 standard right ?

9 ответов

50 просмотров

https://godbolt.org/z/P5v1z5M9v

mito- Автор вопроса
²
https://godbolt.org/z/P5v1z5M9v

Ah yeah, seems like gcc 12.2 doesn't have the support.

Debian Is not a good distro for desktop and above all developong, is too old, try Fedora or Arch Linux(for example) or other distro with software not obsolete.

mito- Автор вопроса
David Costa
u can use Debian sid/testing...

Unstable Is Better for desktop

Похожие вопросы

Обсуждают сегодня

Господа, а что сейчас вообще с рынком труда на делфи происходит? Какова ситуация?
Rꙮman Yankꙮvsky
29
А вообще, что может смущать в самой Julia - бы сказал, что нет единого стандартного подхода по многим моментам, поэтому многое выглядит как "хаки" и произвол. Короче говоря, с...
Viktor G.
2
@Benzenoid can you tell me the easiest, and safest way to bu.y HEX now?
Živa Žena
20
This is a question from my wife who make a fortune with memes 😂😂 About the Migration and Tokens: 1. How will the old tokens be migrated to the new $LGCYX network? What is th...
🍿 °anton°
2
30500 за редактор? )
Владимир
47
а через ESC-код ?
Alexey Kulakov
29
What is the Dex situation? Agora team started with the Pnetwork for their dex which helped them both with integration. It’s completed but as you can see from the Pnetwork ann...
Ben
1
Гайс, вопрос для разносторонее развитых: читаю стрим с юарта, нада выделять с него фреймы с определенной структурой, если ли чо готовое, или долбаться с ринг буффером? нада у...
Vitaly
9
Anyone knows where there are some instructions or discort about failed bridge transactions ?
Jochem
21
@lozuk how do I get my phex copies of my ehex from a atomic wallet, to move to my rabby?
Justfrontin 👀
11
Карта сайта