Newsgroups: comp.lang.c
Path: utzoo!utgpu!watserv1!maytag!xenitec!iguana!merce
From: merce@iguana.uucp (Jim Mercer)
Subject: Re: int32 et al.
Message-ID: <1991Jan24.031542.7790@iguana.uucp>
Organization: Ed (the iguana) Memorial Society
References: <14905@smoke.brl.mil> <1991Jan21.135216.23447@odi.com> <1991Jan23.120327.17759@watmath.waterloo.edu>
Date: Thu, 24 Jan 91 03:15:42 GMT

In article <1991Jan23.120327.17759@watmath.waterloo.edu> datangua@watmath.waterloo.edu (David Tanguay) writes:
>In article <1991Jan21.135216.23447@odi.com> benson@odi.com (Benson I. Margulies) writes:
>|>But you didn't address the problems I pointed out, for example the
>|>complete lack of ANY type whose size if precisely 32 bits in some
>|>implementations.
>|Well, if we ever hit such a beast, there's always
>|typedef char [4] int32;
>
>Which still isn't (necessarily) 32 bits. There is no guarantee that a char
>is exactly 8 bits (36 bit machines use 9 bit chars, and I wouldn't be
>surprised to see a 16 bit char on a 16 bit word machine like the
>Honeywell DPS-6).

[ i'm just jumping into this thread, so please forgive me if this was already
  said ]

could the problem be resolved as such:

[defs.h] (or some similar file)

/* define the type which is 8 bits on your system */

#define BITS8	char
/* #define BITS8	int */
/* #define BITS8	some_other_type */


[sample.c]

...

BITS8	bits8;
BITS16	bits16[2];
BITS32	bits32[4];

this could also be done with typedefs i guess.  (i don't use them much)

this also assumes your system has an 8 bit type.

-- 
[ Jim Mercer   work: jim@lsuc.on.ca  home: merce@iguana.uucp  +1 519 570-3467 ]
[                "Clickity-Click, Barba-Trick" - The Barbapapas               ]
