Talk:Thinker

Language standard conflicts
I don't believe it is true that casting a pointer to a struct to a pointer to its first element and back is illegal in C11.

The standard explicitly addresses this. Referring to https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf:

§6.7.2.1p15: "A pointer to a structure object, suitably converted, points to its initial member (or if that member is a bit-field, then to the unit in which it resides), and vice versa."

The strict aliasing rules (§6.5p7) permit this as well; the compiler must treat an lvalue of the same type as a member of a struct as a potential alias.

- 78.82.191.180 11:41, 28 December 2022 (CST)