Actions

icon Post
text/html Subscribe
text/html Unsubscribe

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

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


  • To: vsipl++@xxxxxxxxxxxxxxxx, nathan@xxxxxxxxxxxxxxxx
  • Subject: Re: [vsipl++-csl] [patch] Vector assignment, sarsim bits
  • From: "Nathan (Jasper) Myers" <ncm@xxxxxxxxxxxxxxxx>
  • Date: Mon, 26 Sep 2005 10:52:56 -0700

On Mon, Sep 26, 2005 at 09:59:56AM -0700, Mark Mitchell wrote:
> Nathan (Jasper) Myers wrote:
> 
> >>Writing a test for my fresh implementation for operator^ I observe
> >>that
> >>
> >>  std::cout << typeid(false^true).name() << std::endl;
> >>
> >>prints 'i', and not 'b' as I had expected. 
> 
> I think Nathan Sidwell may have already answered, but this is not a bug;
> the usual arithmetic conversations are applied to the operands before
> applying "^", so the result of "false ^ true" is of type "int".

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.

Nathan Myers
ncm