this post was submitted on 24 Dec 2023
0 points (NaN% liked)

C++

1757 readers
4 users here now

The center for all discussion and news regarding C++.

Rules

founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] mrkite@programming.dev 1 points 10 months ago

It violates the principle of least surprise. You don't expect the compiler to delete your bounds checking etc.

The way c and c++ define and use UB is like finding an error at compile time and instead of reporting it, the compiler decides to exploit it.