Extremely CISC instructions

Van Snyder van.snyder at sbcglobal.net
Wed Aug 25 16:40:19 CDT 2021


On Wed, 2021-08-25 at 14:08 -0700, Fred Cisin via cctalk wrote:
> >> That is not how C defines bytes or ints, fyi.
> 
> On Wed, 25 Aug 2021, ben via cctalk wrote:
> > I suspect the standard says a byte is at least 7 bits.
> > Thus 8 bit data is NOT PORTABLE.
> 
> I don't know from "the standard", but, K&R said that
> an "int" could be whatever size was most convenient for the
> processor, 
> BUT, that an "int" could not be shorter than a "short", nor longer
> than a 
> "long"

The C 2011 standard (ISO/IEC 9980-2011) subclause 6.2.5 paragraphs 4-9
say

   There are five standard signed integer types, designated as signed
   char, short int, int, long int, and long long int. (These and other
   types may be designated in several additional ways, as described in
   6.7.2.) There may also be implementation-defined extended signed
   integer types.38) The standard and extended signed integer types are
   collectively called signed integer types.
   
   An object declared as type signed char occupies the same amount of
   storage as‘‘plain’’ char object. A ‘‘plain’’ int object has the natural
   size suggested by the architecture of the execution environment (large
   enough to contain any value in the range INT_MIN to INT_MAX as defined
   in the header <limits.h>).

   For each of the signed integer types, there is a corresponding (but
   different) unsigned integer type (designated with the keyword unsigned)
   that uses the same amount of storage (including sign information) and
   has the same alignment requirements. The type _Bool and the unsigned
   integer types that correspond to the standard signed integer types are
   the standard unsigned integer types. The unsigned integer types that
   correspond to the extended signed integer types are the extended
   unsigned integer types. The standard and extended unsigned integer
   types are collectively called unsigned integer types.
   
   The standard signed integer types and standard unsigned integer types
   are collectively called the standard integer types; the extended signed
   integer types and extended unsigned integer types are collectively
   called the extended integer types.

   For any two integer types with the same signedness and different
   integer conversion rank (see 6.3.1.1), the range of values of the type
   with smaller integer conversion rank issubrange of the values of the
   other type.

   The range of nonnegative values of a signed integer type is a subrange
   of the corresponding unsigned integer type, and the representation of
   the same value in each type is the same.41) A computation involving
   unsigned operands can never overflow, because a result that cannot be
   represented by the resulting unsigned integer type is reduced modulo
   the number that is one greater than the largest value that can be
   represented by the resulting type.

41) The same representation and alignment requirements are meant to
imply interchangeability as arguments to functions, return values from
functions, and members of unions.



More information about the cctech mailing list