28-03-2025, 01:05 PM
The aim of the rule is to make the intent of the cast clear.
If aliases were allowed, as std::uintptr_t is itself an alias to some other type T, this would mean that any cast to T (or other alias of T) would also have to be allowed. You have lost the clarity that you are intentionally casting a pointer to a 'big enough' integer.
If aliases were allowed, as std::uintptr_t is itself an alias to some other type T, this would mean that any cast to T (or other alias of T) would also have to be allowed. You have lost the clarity that you are intentionally casting a pointer to a 'big enough' integer.
Posted by and on behalf of
the MISRA C++ Working Group
the MISRA C++ Working Group