5 ms·
Its a crippled form of code generator in an era where compile time execution is suported by many modern system languages. But I don't like any of them. I prefe
by pmarin 3y ago
Its a crippled form of code generator in an era where compile time execution is suported by many modern system languages.
But I don't like any of them. I prefer to write my own code generators.
- klodolph 3y agoC doesn't have that version of constexpr. In C2x, constexpr is just a way to define constants, like constexpr unsigned long long kMyBigNum = 0x1234123412341234ull; Previously, you had to #define. Using enum causes problems when it doesn't fit in an int. And const doesn't mean the right thing: const int kArraySize = 5; void MyFunction(void) { int array[kArraySize]; // NO! } The above function will work if you have VLAs enabled, or if your compiler specifically allows for it. It's nice to have a standardized version that works everywhere (VLAs don't work everywhere).
- flohofwoe 3y agoConstexpr in C is essentially what const should have been, it's not as "powerful" as the C++ version.