[comp.lang.c] n bit architectures and C/C++

chrisj@pdx041.intel.com (Chris Jones) (05/23/91)

In article <1991May22.211056.19387@ready.eng.ready.com>, dhoward@ready.eng.ready.com (David Howard) writes:
|> The question as to whether C types should map to the architecture or
|> to what is easiest on the programmer is an interesting one.

Indeed.  IMHO, a language should not be mapped to any particular architecture.
This creates problems (like the question posed at the beginning of this stream
long ago...)  The compiler should be responsible for implementing the wishes
of the programmer, no matter how warped it is in relation to the particular
chip it is running on.  Unfortunately, the designers of C could not forsee the
need for n-bit integers.  Wouldn't it be nice to just be able to do this...

typedef int24 int       /* This program needs to use 24 bit integers     */
typedef int35 long      /*  and 35 bit longs.  No matter what it takes.  */

Note that portability issues would be lessened, as compilers would be forced
to implement the original wishes of the programmer.  Programmers would still
program for efficiency, so 16/32/64 bit ints/longs would dominate anyway.  I
realize that this raises more issues, like, what is MAXINT?

I'd sure hate to implement this, though.  S'pose it's too late, anyway.

+----------------------------------+------------------------------------------+
{ Chris S Jones, Intel Corp.       | The opinions expressed above probably do }
{ 5200 NE Elam Young Pkwy, JF1-58  | not reflect the opinions of Intel. If    }
{ Hillsboro, OR 97124              | they actually do reflect the opinions of }
{ chrisj@ichips.intel.com          | Intel, it is purely coincidental, since  }
{ (503) 696-4022                   | Intel would never comment on such matters}
+----------------------------------+------------------------------------------+

worley@compass.com (Dale Worley) (05/23/91)

In article <1991May22.235538.9548@ichips.intel.com> chrisj@pdx041.intel.com (Chris Jones) writes:
   Wouldn't it be nice to just be able to do this...

   typedef int24 int       /* This program needs to use 24 bit integers     */
   typedef int35 long      /*  and 35 bit longs.  No matter what it takes.  */

If I remember correctly, PL/1 allowed "DECLARE BINARY(24) FOO;".  And
the much-maligned Cobol has "PICTURE IS 9999".  (That's one reason
businesses like Cobol -- it's actually portable.)  In Pascal you can
say something like "x : 0..32767" to give an explicit range, I think.

Dale

Dale Worley		Compass, Inc.			worley@compass.com
--
Trying to shoot yourself in the foot in:
Prolog: You attempt to shoot yourself in the foot, but the bullet, failing
        to find its mark, backtracks into the gun which then explodes in
        your face. <BG>