r/ProgrammerHumor • • 13d ago

Meme cppAndItsVectorBooleans

Post image
3.4k Upvotes

214 comments sorted by

View all comments

Show parent comment

1

u/No-Information-2571 13d ago

What?

No, "undefined behaviour" is a very specific thing, and there's actually not too many of them, and those that are there, have good reasons.

  1. Signed int overflow
  2. Division/modulo by zero
  3. Shift by < 0 or >= type width
  4. Float to int with mismatching type
  5. Null pointer dereference
  6. Out-of-bounds array access
  7. Certain pointer arithmetic
  8. Use after free, double delete
  9. delete mismatch when new/new[]
  10. Delete without virtual destructor
  11. ...

Etc. etc. - and a rather large number you will get warnings in the compiler already. Either way, all of them have tangible reasons.

0

u/vpgel 8d ago

"Actually not too many of them" and yet you outlined at least 10. "Have good reasons" - what reasons?

0

u/No-Information-2571 8d ago

Maybe read the list before asking such a stupid question? Thanks.