Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!mit-eddie!ll-xn!ames!lll-tis!ohlone!lll-winken!csustan!csun!aeusesef From: aeusesef@csun.UUCP (Sean Eric Fagan) Newsgroups: comp.lang.c Subject: Re: Long integers Message-ID: <749@csun.UUCP> Date: Tue, 15-Sep-87 11:27:52 EDT Article-I.D.: csun.749 Posted: Tue Sep 15 11:27:52 1987 Date-Received: Fri, 18-Sep-87 01:53:34 EDT References: <9266@brl-adm.ARPA> Reply-To: aeusesef@csun.UUCP (Sean Eric Fagan) Organization: California State University, Northridge Lines: 25 In article <9266@brl-adm.ARPA> moss@BRL.ARPA (Gary S. Moss (SLCBR-VL-V)) writes: >George, > The format %ld is wrong when using the PRINTF family of functions. >The reason for this is that integer arguments are *always* widened to LONG >when passed in to a function, so the %d format is meant for LONGS. This >is also true for %f. I am not certain, but pretty sure that I have gotten >wrong behavior when using %ld in this context on certain hardware. > >~moss Uhm, I think you're going to get a lot of flack about this, so I'll start it. C does *NOT* convert integer arguments to longs unless a)told to (via (long) typecast or a 'L' at the end of the suffix) or b)needs to because it is used in an expression where one of the subexpressions is a long (did that make sense?). Remember, this all comes from a PDP-11, where having longs meant extra work for the cpu. Floats are, however, converted to doubles. Of course, I could be wrong, but I don't believe so. ----- Sean Eric Fagan Office of Computing/Communications Resources (213) 852 5742 Suite 2600 1GTLSEF@CALSTATE.BITNET 5670 Wilshire Boulevard Los Angeles, CA 90036 {litvax, rdlvax, psivax, hplabs, ihnp4}!csun!aeusesef "Tempus fugit AirCal"