[vsipl++] Re: [vsipl++-csl] [patch] Vector assignment, sarsim bits

Mark Mitchell mark at codesourcery.com
Mon Sep 26 18:04:35 UTC 2005


Nathan (Jasper) Myers wrote:

> From a C++ coder standpoint, this is very surprising.  "The usual
> arithmetic conversions" was one of the areas where the C++ committee
> (library, perhaps, moreso than core?) deliberately broke from C.  
> Am I right, then, that it's allowed-but-not-required for the result 
> to stay bool?  If G++ can do that, it should.

A conforming compiler is required to promote to int.  See [expr]/9:
"Otherwise, the integral promotions shall be performed on both
operands".  There's nothing special about "^"; the usual arithmetic
conversions are applied to all operands of arithmetic binary operators,
like +, -, *, etc., and, as a result, the type of such expressions is
always at least as wide as "int".

-- 
Mark Mitchell
CodeSourcery, LLC
mark at codesourcery.com
(916) 791-8304



More information about the vsipl++ mailing list