|
|
|
|
|
by bombcar
1710 days ago
|
|
It is possible - but not whilst maintaining standards-compliance and there are always/often another one where you least expect it. At the root is taking a “assume the programmers know what they are doing” language and turning it into a “assume the programmers are drooling morons” language. |
|
For example: the compiler is assuming someone isn't ignorant and knows, for example, if they want to write a variable as one type and read it as another, they need to consider two things: they are now in implementation-dependent territory (big endian vs little endian effects, for example), and they need to use unions, not just casts, if the same data can be interpreted as two different types and neither is array of char. Failure to use unions properly triggers aliasing problems.