[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [csmith-dev] int8_t usage
On Tue, Sep 27, 2011 at 10:41 PM, John Regehr <email@example.com> wrote:
> On 09/09/2011 12:45 AM, Arthur O'Dwyer wrote:
>> On Thu, Sep 8, 2011 at 10:49 AM, John Regehr<firstname.lastname@example.org> wrote:
>>>> That would be 16 bit. :) I know, it's a pretty wierd arch!
>>> Is this a conforming C implementation? I thought it was required that
>>> int is larger than char.
>> FYI, nope, it's only required that int be *at least as large* as
>> signed char. I remember this from my comp.lang.c days. ;) This can
>> cause huge problems with code that reads binary files, since you can
>> no longer distinguish EOF from a valid 'char' value, but hey, that's
>> why feof() exists.
> In C99, INT_MAX cannot be less than 32767.
> I get this from §18.104.22.168.1 of n1256.pdf.
> Perhaps it is ANSI C that permits int to be as small as a char?
All correct. Both C89 and C99 permit int to be as small as a char, as
long as int is at least 16 bits. Of course, if int is 16 bits and int
is as small as char, then char must *also* be 16 bits. I believe this
is exactly the case that Paulo was describing. We are in violent
agreement on all points. ;)