|
|
|
|
|
by kccqzy
729 days ago
|
|
> things that people reasonably can assume would work but are UB anyway (signed integer overflow.) Since when is it reasonable to assume that? > Then you have weird edge cases like assigning the return value of a two argument std::max involving temporaries to a reference You have a reference to a temporary. Reference lifetime extension is a thing. No UB there. Completely defined and supported. |
|
However, some benchmarks use iteration on a signed integer, and assuming that loop terminates makes it slightly faster, so in order to retain that marginal advantage over other languages, signed iteration shall be assumed to never overflow.
This is very typical of the C++ experience.