On Mon, 29 Jul 2024, Vincent Lefevre wrote:
With GCC, in C, is they a way to create a new integer type, incompatible with other types? For instance, a new integer type that would have the same size as long int, but that would be incompatible with it. On a 64-bit platform, one could use long long int, but if one wants to create 3 or more types similar to long int, one would need some other method. The main goal would be to improve the robustness of the code by detecting programming errors at compile time, without making testing much complex to achieve this goal. Note: The code to be tested must have minimal changes, so that encapsulating an integer type in a struct is not possible. And this must be C, not C++.
I don't think you can "create" new ones arbitrarily, but if another one already exists, you could use that. For instance _BitInt(64) with a recent enough gcc.
-- Marc Glisse