Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!bellcore!faline!ulysses!allegra!alice!ark From: ark@alice.UUCP Newsgroups: comp.lang.c Subject: Re: Long integers Message-ID: <7275@alice.UUCP> Date: Mon, 14-Sep-87 16:29:07 EDT Article-I.D.: alice.7275 Posted: Mon Sep 14 16:29:07 1987 Date-Received: Wed, 16-Sep-87 06:01:12 EDT References: <9266@brl-adm.ARPA> Organization: AT&T Bell Laboratories, Liberty Corner NJ Lines: 11 In article <9266@brl-adm.ARPA>, moss@BRL.ARPA writes: > 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. Nope. Chars and shorts are widened to ints, and floats are widened to doubles, but ints are not widened to longs. Thus you should always use %d for char, short, or int, and %ld for long.