"Undefined behavior" is a quirk of the C++ ISO standard legalese, not some property of computing or of the C++ language.
Briefly, the C++ standard defined three classes of stuff that isn't covered by the standard:
Implementation-defined behavior - "behavior, for a well-formed program construct and correct data, that depends on the implementation and that each implementation documents".
Unspecified behavior - "behavior, for a well-formed program construct and correct data, that depends on the implementation".
Undefined behavior - "behavior for which this document imposes no requirements".
So 'undefined behavior' is stuff that isn't mandated by the standard and also may or may not be an error.
Some UB stuff is bugs (like accessing arrays out of bounds), some isn't bugs but just processor/OS dependent stuff that is out of scope of the C++ standard. (Like what happens when integers overflow.)
In short, the existence of UB is a good thing; having a standard that clearly states what is part of it and what isn't is vastly better than a standard that mandates too much or is too vague.
(And it goes without saying that having no standard at all, like is usual for other programming languages in 2019, is worse in every way.)
Briefly, the C++ standard defined three classes of stuff that isn't covered by the standard:
Implementation-defined behavior - "behavior, for a well-formed program construct and correct data, that depends on the implementation and that each implementation documents".
Unspecified behavior - "behavior, for a well-formed program construct and correct data, that depends on the implementation".
Undefined behavior - "behavior for which this document imposes no requirements".
So 'undefined behavior' is stuff that isn't mandated by the standard and also may or may not be an error.
Some UB stuff is bugs (like accessing arrays out of bounds), some isn't bugs but just processor/OS dependent stuff that is out of scope of the C++ standard. (Like what happens when integers overflow.)
In short, the existence of UB is a good thing; having a standard that clearly states what is part of it and what isn't is vastly better than a standard that mandates too much or is too vague.
(And it goes without saying that having no standard at all, like is usual for other programming languages in 2019, is worse in every way.)