6 ms·
intmax_t is a dumb idea. Conceptually intmax_t is a generic type of the form intmax_t<T>. Since C does not have generics, the T is chosen by the compiler durin
by imtringued 2mo ago
intmax_t is a dumb idea.
Conceptually intmax_t is a generic type of the form intmax_t<T>. Since C does not have generics, the T is chosen by the compiler during compile time.
But this means that the first time you compile any shared library with an intmax_t parameter or return value in one of its functions, you have permanently baked in the type parameter T to whatever the compiler chose it to be at that moment in time.
You cannot retroactively change intmax_t even if you change the symbols, because intmax_t runs into the same problem any generics system does, you cannot retroactively add instantiations for future types that were not explicitly compiled into the dynamic library.
Even if C gets generics and intmax_t would become obsolete either way, because you don't need intmax_t<T>, you can just have T.
intmax_t is only interesting for choosing the T and even then it is only interesting inside function implementations and never in their signatures.
So my conclusion is that intmax_t was a failed attempt at trying to be "clever" with the idea of introducing generics without introducing generics. This is an idea that is so doomed that anyone trying to rescue it, didn't really understand the problem with intmax_t.
- wahern 2mo ago> This is an idea that is so doomed that anyone trying to rescue it, didn't really understand the problem with intmax_t. The C committee doesn't want to rescue intmax_t. If they had a time machine most members would prevent it ever being added. But it was and now it can't be removed; it takes decades to get breaking changes into the standard. intmax_t is a thornier problem than time_t and needs a more comprehensive approach that requires some careful assistance from the C standard itself. There's no completely fixing the mess. The goal is to find an acceptable solution that allows everybody to begin to move past intmax_t given the various technical and practical constraints. The goal is not to find a solution that allows for expanded use of intmax_t, at least not in the standard, though it may be the case it can never completely go away.
- cryptonector 2mo agoI'd rather `intmax_t` be deprecated and marked for removal. It was a terrible mistake.