[vsipl++] patch: Some more adjustments for intel-win

Mark Mitchell mark at codesourcery.com
Tue Sep 12 03:50:12 UTC 2006


Stefan Seefeld wrote:

> +# if SIZEOF_CHAR == 1
> +  typedef signed char int8_type;
> +  typedef unsigned char uint8_type;
> +# else
> +#  error "No 8-bit integer type"
> +# endif
> +
> +# if SIZEOF_SHORT == 2
> +  typedef short int16_type;
> +  typedef unsigned short uint16_type;

Just for the record:

1. sizeof (char) is required to be 1 in C++.

2. However, char is not required to be an 8-bit type.

So, in theory, these checks (which you added at my suggestion) are not 
fully robust.  For example, on a machine for which char is a 32-bit 
type, the above code will not work as intended.

However, I would not worry about this -- not even a little bit.  There 
are a very few such machines, and none in mainstream use, and if we find 
one, we can always fix this at that point.  (One relatively portable way 
might be to use UCHAR_{MIN,MAX} to tell us how many bits are actually in 
a char.)

-- 
Mark Mitchell
CodeSourcery
mark at codesourcery.com
(650) 331-3385 x713



More information about the vsipl++ mailing list