Re:The trouble with struct sockaddr's fake flexible array
by ivanbakel on Friday November 29, 2024 @11:38AM
(#42274990)
That's a rathee obtuse response. You can typically operate under the assumption that the compiler works correctly. The question of the GP was - what prevents the compiler from (correctly) exploiting UB to change the program behaviour from the desired one? If the Linux devs want to rely on their compilers' output, they have to somehow be obeying the contract around UB.
[ Parent
| on HN ]
Re:The trouble with struct sockaddr's fake flexible array
by shawnz on Friday November 29, 2024 @12:26PM
(#42275381)
I think the more reasonable assumption is that the practical needs of the biggest users will probably trump what any specification demands.
The thing stopping the compiler from doing dangerous behaviours in response to commonly abused UB is obviously that people wouldn't use the compiler if it did that. Just like how the thing stopping the compiler from doing dangerous behaviours in response to spec-legal code is that people wouldn't use it if it did that.