
27 Sep
2004
27 Sep
'04
9:59 a.m.
Victor A. Wagner Jr. <vawjr@rudbek.com> wrote:
I don't see the safety issue and what you showed is incorrect; a + (b-a) / 2 is at least correct, but b-a overflows just as readily as a+b
oops, for sure, b-a rather. I'm missing some understanding, given that b >= a, why is b-a just as ready to overflow as a+b? I guess you are saying b - a > 2GB (typical ptrdiff_t) is just as likely as an overflow from a + b, if it was legal, on a common 32 bit platform for example, or have I misunderstood? matt. matthurd@acm.org