This is the mail archive of the
mailing list for the GCC project.
Re: `quad' printf format specifier ?
- To: Marc dot Espie at liafa dot jussieu dot fr, zack at blastula dot phys dot columbia dot edu
- Subject: Re: `quad' printf format specifier ?
- From: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- Date: Sat, 6 Feb 1999 00:03:47 -0500 (EST)
- Cc: egcs-bugs at egcs dot cygnus dot com, millert at cvs dot openbsd dot org
> From: Zack Weinberg <email@example.com>
> On Sat, 6 Feb 1999 01:10:39 +0100, Marc Espie wrote:
> >What is the exact status of the quad format specifier in printf ("qd"
> >extension) ?
> >As far as I know, it is intended to handle 64 bits comfortably on all
> >machines, and was originally a bsd-ism (quad_t).
> >However, egcs (and gcc before that) treats it as equivalent to ll, which
> >is not always equivalent: openbsd-alpha is configured so that long is
> >64 bits, and hence quad_t is typedef'ed to long.
> >In that particular case, the printf-like attribute doesn't work as
> If sizeof (long long) == sizeof (long) on openbsd-alpha, it should work
> anyway - i.e. %ld, %lld, and %qd should be interchangeable. What problems
> are you seeing?
They might _work_ interchangeably, but the -Wformat checks would
flag one (or more) as incorrect. (Cause its not portable to assume
sizeof (long long) == sizeof (long), and the format checks make sure
your code would work anywhere.)
> (Note this is a libc issue, not a compiler issue, unless your problem is
> with gcc's format checking.)
I think his problem is with gcc's format checking.
I think either openbsd's notion of quad_t is incorrect, or gcc -Wformat
check is wrong. Is there any standard that governs quad_t that says its
either a long long or 64 bits?
Kaveh R. Ghazi Engagement Manager / Project Services
firstname.lastname@example.org Qwest Internet Solutions