Subject: Re: Tcl7.5 and NetBSD-current
To: None <mrg@eterna.com.au>
From: Peter Seebach <seebs@solon.com>
List: current-users
Date: 02/27/1996 06:17:47
>it is not _our_ fault.  it is inherent in the way that printf() is/was
>designed.  in what way is our C implimentation not conforming ?

long long is *forbidden* by ANSI.  The list "char short int long" is an
exhaustive one, and the format "%qd" is not defined.

Any implementation on which you need to use an extension to get at basic
functionality is nonconforming.

Test: (not legally binding, but proves the point)
	gcc -pedantic -Wall -Werror
rejects our stdio.h.

>i think you'll find that more and more os's go to >32 bit off_t's and
>will lose with his bit of (broken) code.  tcl should be `fixed', not
>our system modified to be broken.

Tcl is correct; it is printing the largest integral type.  A conforming
C implementation is forbidden from offering larger types, and must diagnose
"long long" as a syntax error.  Casting an object to long int, and printing
it, is *guaranteed* to give you the largest possible signed integer range.
If the compiler does not work this way, the compiler is broken.

The last time this came up, it was pointed out (correctly, I believe) that
too much software breaks if we change this for us to do the "correct" thing
of having long be the 64 bit type.  I still think we ought to hide this
carefully in headers, and make it possible to switch which names are used
for which sizes from compile to compile.  (Make all the source use
int32_t, int64_t, et al., then have a switch for what size long is, and
if long is 64 bit, excise long long completely.)

-s