3 ms·
As tom_mellior says, CompCert is just a compiler, and it's not deviating from the C standard. The C standard says that sizeof(int) is implementation defined. C
by MaxBarraclough 9y ago
As tom_mellior says, CompCert is just a compiler, and it's not deviating from the C standard.
The C standard says that sizeof(int) is implementation defined. CompCert has to choose a size, and they go with the unsurprising choice of 32-bit.
As for no UB in signed overflows: where the C standard says 'undefined behavior', that doesn't prohibit an implementation (i.e. a compiler) from picking a well-defined behavior. It just means that portable code mustn't rely on that behavior - build such code on a different standards-compliant compiler and you might end up with demons flying out of your nose, etc.
> it is practically impossible to find some actually useful C code that is fully portable and compliant.
Disagree. The C/C++ code I've written has been portable and standard. The hardest part was that CMake is a trainwreck.
> if the default settings lead to way too many false positives, the users might end up giving up before learning how to turn some of them off
That's more an issue with legacy code that when writing new code.