From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,8c8bbb1419c8e81a X-Google-Attributes: gid103376,public From: kaz@vision.crest.nt.com (Kaz Kylheku) Subject: Re: Waiver question Date: 1997/04/29 Message-ID: <5k61ah$h1l@bcrkh13.bnr.ca>#1/1 X-Deja-AN: 238276899 References: <33585385.C8D@lmtas.lmco.com> <1997Apr28.151327.1@eisner> Organization: Prism Systems Inc. Newsgroups: comp.lang.ada Date: 1997-04-29T00:00:00+00:00 List-Id: In article , Corey Minyard wrote: >The minimum addressable unit on the Alpha is a byte (8 bits). The >alignment of 32-bit values (and instructions) on the the Alpha is on >32-bit boundaries, but there is no alignment restriction on bytes. >The issue is if you increment a pointer value physically by 1 how many >bits do you skip over? For instance, the following code (and I hope >the kind readers of the newsgroup excuse me for using C, but it is >more compact for this type of stuff): Stated more compactly, the question is the size of a character with respect to a long integer. >on the Alpha will print: > 1020304 0 0 0 >and on the C40 will print: > 1 2 3 4 >because on the C40 a char and an int are the same size because the >minimum size of any addressable unit is 32-bits. Note that this will cause severe problems for the C standard I/O library. The return value of the getc function is 'int'. The library assumes that the range of unsigned char (0 to UCHAR_MAX) is a subrange of int (INT_MIN to INT_MAX), and that an EOF value can be placed in the int range such that it doesn't interfere with the unsigned char subrange. (The values 0 to UCHAR_MAX must be representable because binary streams must transparently record internal data, according to the standard, and internal data is composed of bytes. Any byte value written must read back correctly.) If sizeof(char) == sizeof(int) == sizeof(unsigned int), getc cannot be properly implemented, because the range of int is too small to capture all the values of unsigned char _and_ have room for an EOF. Thus a conforming hosted implementation of C is not possible. Ha ha. :) That's what you get for overloading the meaning of a return value.