#include <stdio.h>
int foo() { return 0; }
int a = foo();
int main() {
return 0;
}
The code above can not be complied because of
From section 3.5.7 Initialization of the C standard:
All the expressions in an initializer for an object that has static storage duration or in an initializer list for an object that has aggregate or union type shall be constant expressions.
#include <iostream>
int foo() { return 0; }
int a = foo();
int main() {
return 0;
}
However, I don't know why it can be complied in C++ without using constexpr
I want to mention that my main question is why it can be complied in C++ without using constexpr