|
|
|
|
|
by adrian17
22 days ago
|
|
I think this is 6.3.2.3.7 in C99 about casting between pointer types: > If the resulting pointer is not correctly aligned for the
pointed-to type, the behavior is undefined. However, unless I’m missing something, producing such a pointer from an integer is apparently not insta-UB? 6.3.2.2.5: > An integer may be converted to any pointer type. Except as previously specified, the
result is implementation-defined, might not be correctly aligned, might not point to an
entity of the referenced type, and might be a trap representation And later on 6.5.3.2.4: > If an invalid value has been assigned to the pointer, the behavior of the unary * operator is undefined. Which implies that the invalid pointer must have been obtained without being already undefined, right? |
|