2 ms·
Casting pointers is well defined. What is undefined behavior is to dereference a pointer whose type does not match the pointed-to object.
by koorogi 10y ago
Casting pointers is well defined. What is undefined behavior is to dereference a pointer whose type does not match the pointed-to object.
- akvadrako 10y agoThat's not correct in general; casting pointers is possibly undefined. However, it does seem a made a mistake trying to use void * as an example.