Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!cmcl2!brl-adm!brl-smoke!gwyn From: gwyn@brl-smoke.ARPA (Doug Gwyn ) Newsgroups: comp.lang.c Subject: Re: Long integers Message-ID: <6439@brl-smoke.ARPA> Date: Sun, 20-Sep-87 20:18:18 EDT Article-I.D.: brl-smok.6439 Posted: Sun Sep 20 20:18:18 1987 Date-Received: Mon, 21-Sep-87 00:38:22 EDT References: <9266@brl-adm.ARPA> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 10 In article <9266@brl-adm.ARPA> moss@BRL.ARPA (Gary S. Moss (SLCBR-VL-V)) writes: >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 completely wrong! Pre-ANSI C function arguments are widened, all right, but not to (long). All non-long integral types are widened to (int) (or (unsigned int), same size). %ld should not be used with (int) parameters to *printf(), but only with (long) parameters. Scanf(), since it takes pointers, is unaffected by parameter widening.