not really Re: Style guides and portability

Dave Eisen dkeisen at Gang-of-Four.Stanford.EDU
Thu Jan 17 04:24:39 AEST 1991


In article <1991Jan15.054540.1466 at athena.mit.edu> scs at adam.mit.edu writes:
>
>In article <10608 at hydra.Helsinki.FI>, Lars Wirzenius asks:
>>Is there any problem in using 
>>	printf("%ld", (long) bigint)
>>other than that it's clumsy?
>
>None whatsoever (as long as bigint is known to map to a built-in,
>integral type, which in the problem under discussion, it was).
>This is a much better solution.  (It's not even all that clumsy.)


It sorta defeats the purpose, doesn't it? 

The point of using a type like int32 is to avoid hardcoding the 
current compiler's idea of what a long looks like into the code and
here you are using "lf" and "long" thousands of times all over your
code. If you wanted to go this route, maybe something like 

#define BIGINT_FORMAT  "ld"
#define BIGINT_TYPE     long

would be appropriate.


It doesn't seem worth it to me. I expect I'll regret that decision
someday.




--
Dave Eisen                   "I strongly suspect the "right man" could go a
1447 N. Shoreline Blvd.       *long* way toward solving your "problem".
Mountain View, CA 94043         --- Dan Mocsney, offering himself for the job
(415) 967-5644                dkeisen@$Gang-of-Four.Stanford.EDU



More information about the Comp.lang.c mailing list