Would you, please, explain how this rationale is compatible with the following statement in the C90/C99 standards:Conversion of an integer into a pointer to void may result in a pointer that is not correctly aligned, resulting in undefined behaviour.
As character pointers contain addresses of individual bytes, they cannot be unaligned. Hence pointers to void cannot be unaligned too, right?C99. 6.2.5 Types. Â§27 wrote:A pointer to void shall have the same representation and alignment requirements as a pointer to a character type.
Moreover, for the cases, in which the alignment problem indeed may occur, the restriction you define (rule 11.4) is, in contrast to 11.6, only advisory.
This rationale does not apply to intptr_t/uintptr_t.Conversion of a pointer to void into an integer may produce a value that cannot be represented in the chosen integer type resulting in undefined behaviour.
This rationale looks like it would deserve a separate rule, as the limitations of these conversions for integers and non-integer arithmetic types are very different.Conversion between any non-integer arithmetic type and pointer to void is undefined.
So were the conversions between intptr_t/uintptr_t and void * disallowed unintentionally or do I just miss a safer way to handle the above described situations than to deviate from 11.6?