Re: code cracking or how do you know you've got the correct key?

From: Douglas A. Gwyn (DAGwyn_at_null.net)
Date: 12/29/04


Date: Wed, 29 Dec 2004 11:55:37 -0600

Bob Harris wrote:
> Gregory G Rose wrote:
>>... ints must be bigger than one byte. ...
> Is that in the standard C definition? I used C compilers 15-20 years ago in
> which ints were 8 bits. Are there not still small micros around with a
> natural word size of 8 bits, and in which an int would naturally be a byte?

The C standard requires that type int have a width of
at least 16 bits. It is misleading to use the term
"byte" in this discussion, as in the C standard a
byte is the basic unit of allocation and could be
wider than 8 bits, indeed a byte could be as wide
as an int. A better term would be "octet".

If a purported C implementation uses only 8 bits in
its int representation, it doesn't conform to the
standard (nor to the expectation of portable code).
There really is no purpose served by such an
implementation choice, since if the program really
wants a narrow integer type, that is available as
type (signed or unsigned) char. Also, as of C99 the
<stdint.h> facilities are standard (and can readily
be provided for pre-C99 implementations).



Relevant Pages

  • Re: Portability: Harmony between PC and microcontroller
    ... int is the natural integer type for the system. ... You are, perhaps unintentionally, paraphrasing the standard in a way ... One of the things that you might not realize is that the C programming ... In the real world, most embedded systems have more complex jobs to do, ...
    (comp.lang.c)
  • Re: Implicit int
    ... There weren't enough standard types to go around, ... The practical necessity was for an integer type that could handle big ... The long int type can handle big integers. ... If you need bigger ...
    (comp.std.c)
  • Re: Bit-fields and integral promotion
    ... > un/signed type knowledge. ... unsigned char, the int-sized object must be treated as signed. ... Admittedly it is unfortunate that the standard does not specifically ... int but an 8-bit unsigned bit field promoted to an unsigned int. ...
    (comp.lang.c)
  • Re: call of variadic function
    ... arguments that should be passed to this function are of type int. ... You call foo with more arguments than are ... which is the standard way to access arguments of a variadic function ... Here the else clause of my sentence specifies one of the numerous non- ...
    (comp.lang.c)
  • Re: CC compiler error with solaris 5.8
    ... but this is what the standard requires.) ... the only version of "abs" available was the ... traditional "int" version. ... Recent updates of Solaris headers and libraries now comply with the C++ standard ...
    (comp.unix.solaris)