3 ms·
Well because it could lead to any result on some platform or compiler, it invalidates assumptions about the program.
by em3rgent0rdr 3mo ago
Well because it could lead to any result on some platform or compiler, it invalidates assumptions about the program.
- LoganDark 3mo agoUB invalidates assumptions about the program not necessarily because it leads to arbitrary behavior in practice, but because it leads to arbitrary behavior in spirit. Even if there is no compiler in existence where the UB causes a problem, that does not make the program correct. UB is about whether the program is correctly defined, not about whether it works or not.