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

Nathan (Jasper) Myers ncm at codesourcery.com
Mon Sep 26 17:52:56 UTC 2005


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



More information about the vsipl++ mailing list