Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!ll-xn!ames!oliveb!sun!guy From: guy@sun.uucp (Guy Harris) Newsgroups: comp.lang.c Subject: Re: Long integers Message-ID: <27945@sun.uucp> Date: Mon, 14-Sep-87 17:00:41 EDT Article-I.D.: sun.27945 Posted: Mon Sep 14 17:00:41 1987 Date-Received: Wed, 16-Sep-87 01:35:24 EDT References: <9266@brl-adm.ARPA> Organization: Sun Microsystems, Inc. - Mtn View, CA Lines: 15 > 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. Excuse me, but this is total rubbish. Arguments *shorter* than "int" are widened to "int" - NOT "long" - when passed to a function. "int" arguments are left alone. "%d" will NOT work for "long" arguments on a machine where "int" and "long" are not the same size. %d is NOT meant for "long"s, it is meant for "int"s. "%ld" is what you must use for "long"s. -- Guy Harris {ihnp4, decvax, seismo, decwrl, ...}!sun!guy guy@sun.com (or guy@sun.arpa)