Re: Layout Hell-o
From: Michael Wojcik (mwojcik_at_newsguy.com)
Date: 08/04/04
- Next message: Lueko Willms: "Re: Layout Hell-o"
- Previous message: Chuck Stevens: "Re: Layout Hell-o"
- In reply to: Michael Mattias: "Re: Layout Hell-o"
- Next in thread: Richard: "Re: Layout Hell-o"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 4 Aug 2004 16:28:03 GMT
In article <mCtPc.2238$hI.654797@newssvr28.news.prodigy.com>, "Michael Mattias" <michael.mattias@gte.net> writes:
> >
> > On 2-Aug-2004, "Michael Mattias" <michael.mattias@gte.net> wrote:
> >
> > > Incorrect: COBOL BINARY is big-endian (MSB at lowest address); C and
> > > BASIC
> > > have no such native datatype, as their BINARY integers are little-endian
> > > with MSB at highest address.
>
> The COBOL orientation is true on all platforms. Don't know about C/BASIC on
> 'nix or IBM mainframe, but on Windows machines the binary integer is in
> Intel order
The C standard requires that integral types use a "pure binary
numeration system" representation (ISO 9899-1990 6.1.2.5), with
various other restrictions, and in effect require one of sign-
magnitude, one's-complement, or two's-complement. I don't know of a
conforming implementation which uses anything other than two's-
complement. However, I don't believe there's any requirement that
the representation match the "native" pure binary representation used
by the platform - if there is one.
In practice, C implementations essentially always do use the native
integer representation, however, which means that they have big-endian
integers if the CPU uses big-endian integers. For Windows running on
a big-endian CPU (which was an option, once upon a time), C would use
big-endian integers. For Unix, C implementations are either big- or
little-endian depending on the CPU, usually; though for bimodal CPUs
the implementor has to choose the appropriate representation based on
the mode in which they expect the program to run.
There is occasional talk of adding endian-specific type support to C,
but insufficient interest exists to push it through the standard
committee, probably because C's bitwise operators make it trivial to
do the conversion, and utility macros and functions to do it are widely
available anyway. (And adding it to the C standard now would be an
exercise in futility, since few implementations have adopted the 1999
standard.)
As for BASIC - well, AFAIK, the dominant implementation of a language
calling itself "BASIC" doesn't follow any external standard anyway.
-- Michael Wojcik michael.wojcik@microfocus.com Viewers are bugs for famous brands. -- unknown subtitler, Jackie Chan's _Thunderbolt_
- Next message: Lueko Willms: "Re: Layout Hell-o"
- Previous message: Chuck Stevens: "Re: Layout Hell-o"
- In reply to: Michael Mattias: "Re: Layout Hell-o"
- Next in thread: Richard: "Re: Layout Hell-o"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|