comp.lang.ada
 help / color / mirror / Atom feed
From: kaz@vision.crest.nt.com (Kaz Kylheku)
Subject: Re: Waiver question
Date: 1997/04/29
Date: 1997-04-29T00:00:00+00:00	[thread overview]
Message-ID: <5k61ah$h1l@bcrkh13.bnr.ca> (raw)
In-Reply-To: m2zpui69zn.fsf@acm.org


In article <m2zpui69zn.fsf@acm.org>, Corey Minyard  <minyard@acm.org> 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.




  parent reply	other threads:[~1997-04-29  0:00 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-04-18  0:00 Waiver question Ken Garlington
1997-04-19  0:00 ` Tom Moran
1997-04-20  0:00 ` Robert Dewar
1997-04-21  0:00   ` Ken Garlington
1997-04-22  0:00     ` Ken Garlington
1997-04-23  0:00       ` Corey Minyard
1997-04-24  0:00         ` Richard Kenner
1997-04-28  0:00         ` Larry Kilgallen
1997-04-28  0:00           ` Corey Minyard
1997-04-29  0:00             ` Laurent Guerby
1997-04-30  0:00               ` Corey Minyard
1997-04-29  0:00             ` Kaz Kylheku [this message]
1997-04-29  0:00             ` Robert Dewar
1997-04-29  0:00           ` Richard Kenner
1997-04-30  0:00             ` Robert A Duff
1997-05-01  0:00               ` Kaz Kylheku
1997-05-02  0:00                 ` Robert A Duff
1997-05-02  0:00                   ` Larry Kilgallen
1997-05-02  0:00                     ` Robert A Duff
1997-05-02  0:00                       ` Larry Kilgallen
1997-05-03  0:00                         ` Robert A Duff
1997-05-03  0:00                           ` Larry Kilgallen
1997-05-04  0:00                             ` Robert Dewar
1997-05-04  0:00                         ` Robert Dewar
1997-05-02  0:00                     ` Robert Dewar
1997-05-06  0:00                     ` John M. Mills
1997-04-30  0:00             ` Robert Dewar
1997-05-01  0:00               ` Larry Kilgallen
1997-05-07  0:00                 ` Bad .diff files in gnat-3.09 in Linux Benoit Jauvin-Girard
1997-05-09  0:00                   ` Albert K. Lee
1997-04-29  0:00           ` Waiver question Robert Dewar
1997-04-23  0:00     ` Tarjei Jensen
1997-04-20  0:00 ` Dean Runzel
1997-04-22  0:00   ` Ken Garlington
1997-04-20  0:00 ` Steve Doiel
1997-04-21  0:00 ` Robert I. Eachus
1997-04-21  0:00   ` Robert Dewar
1997-04-22  0:00     ` Robert I. Eachus
1997-04-23  0:00       ` Robert Dewar
1997-04-22  0:00   ` Ken Garlington
1997-04-23  0:00     ` Robert S. White
1997-04-24  0:00     ` Robert Dewar
1997-04-24  0:00       ` Steve Vestal
1997-04-25  0:00         ` Robert I. Eachus
1997-04-25  0:00         ` Ken Garlington
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox