int32 et al.

Karl Heuer karl at ima.isc.com
Tue Jan 22 13:38:44 AEST 1991


In article <1991Jan21.135216.23447 at odi.com> benson at odi.com (Benson I. Margulies) writes:
>>>If we used int for a 32 byte int, we are nailed on the PCs.  If we use
>>>long, C++ compilers tend to moan piteously about [type clash]
>
>The system include files contain
>	extern int blahblah (int, char *);
>I don't control that declaration. If I call blahblah with a long,
>the compiler bleats a warning.

How does int32 help, then?  You said you define int32 as long on some machines
(PCs), so passing an int32 to this function is just wrong.  Looks to me as
though you need to cast% it to int, regardless of whether you're using int32
or long.

>for 
>	extern int quux (int *);
>if I pass a long * I get an error, not just a warning.
>So I can't just use long all the time unless I type in all my
>own system function prototypes.

And here, it's worse.  If you fake it with a cast or by writing a fake
prototype, you're likely to get the wrong answer, on machines where int and
long have different sizes.  Again, I see no advantage of int32 over long.

Karl W. Z. Heuer (karl at ima.isc.com or uunet!ima!karl), The Walking Lint
________
% Assuming you already know it fits in an int.



More information about the Comp.lang.c mailing list