Style guides and portability

Paul Tomblin pt at geovision.uucp
Tue Jan 15 01:20:34 AEST 1991


scs at adam.mit.edu (Steve Summit) writes:
>The only
>problem I have with user-defined types in C is printing them.
>If you have

>	int32 bigint;

>do you print it with %d or %ld?  (Come to think of it, this is
>another strong argument in favor of "long int" over "int32".)

Simple, you cast all your integer types to long, and printf them as %ld.
{The cast probably isn't even needed, because it's a variadic function.
If I remember correctly, variadic functions are type promoted the same way
classic C functions are, integer types (char, int, unsigned, etc) are 
promoted to long, real types (float, double) are promoted to double.

Anybody know what happens to "long double" types in variadic functions, or 
is "long double" not an ANSI-C type?
-- 
Paul Tomblin, Department of Redundancy Department.       ! My employer does 
The Romanian Orphans Support Group needs your help,      ! not stand by my
Ask me for details.                                      ! opinions.... 
pt at geovision.gvc.com or {cognos,uunet}!geovision!pt      ! Me neither.



More information about the Comp.lang.c mailing list