Actions

icon Post
text/html Subscribe
text/html Unsubscribe

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • To: "Nathan (Jasper) Myers" <ncm@xxxxxxxxxxxxxxxx>
  • Subject: Re: [vsipl++] Re: [vsipl++-csl] [patch] Vector assignment, sarsim bits
  • From: Mark Mitchell <mark@xxxxxxxxxxxxxxxx>
  • Date: Mon, 26 Sep 2005 11:04:35 -0700

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@xxxxxxxxxxxxxxxx
(916) 791-8304