|
|
|
|
|
by tomp
25 days ago
|
|
ok so Claude says I was wrong, it's more subtle. (1) you can cast between any pointer types (no UB - assuming they're aligned), but accessing memory through a wrongly-typed pointer is UB (2) the only exception is char*, which allows you a "byte view of memory" (3) calling a function through a pointer requires the parameter pointer types to be compatible, and none of these are: int*, struct foo *, void*, char* |
|