Subject: Re: [boost] [review queue] What to do about the library review queue?
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2017-03-15 23:06:28
On Wed, Mar 15, 2017 at 10:24 PM, degski via Boost
> int x = 2 * 2;
> is wrong in principle, correct would be:
> int64_t x = 2 * 2;
> This is what happens in the CPU.
Actually, no. Truncating multiplication is also quite common, and at
least in case of x86 is faster than the widening. Some architectures
(e.g. SPARC) don't even have a widening multiply instruction, so the
operation would have to be emulated. Given that most of the time
overflows are not a concern, I'd say truncating multiplication has the
right to exist. Of course, the widening variant would also be a
welcome option in the language, but hardly it should be the default.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk