From owner-freebsd-current Thu Mar 11 3:16:31 1999 Delivered-To: freebsd-current@freebsd.org Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.26.10.9]) by hub.freebsd.org (Postfix) with ESMTP id 9EBBC15106 for ; Thu, 11 Mar 1999 03:16:26 -0800 (PST) (envelope-from bde@godzilla.zeta.org.au) Received: (from bde@localhost) by godzilla.zeta.org.au (8.8.7/8.8.7) id WAA12554; Thu, 11 Mar 1999 22:16:07 +1100 Date: Thu, 11 Mar 1999 22:16:07 +1100 From: Bruce Evans Message-Id: <199903111116.WAA12554@godzilla.zeta.org.au> To: current@FreeBSD.ORG, dfr@nlsystems.com Subject: Re: Proposed change to printf Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG >I want to make this change to printf so that it treats format codes like >'%llx' as 64bit formats (i.e. the same as '%qx'). This convention is the >same as that used by glibc. %llx is actually for unsigned long longs, and %qx is actually for u_quad_t's. These types are different for FreeBSD on alphas. Printing quad_t's using %llx should cause warnings from gcc -Wformat on alphas, but printing them using %qx should work. I think gcc -Wformat doesn't actually understand %q formats, so printing quad_t's using %qx gives bogus warnings on alphas. However, %llx is more standard. It is in the C9x draft. %qx should go away. >Index: vfprintf.c >=================================================================== >RCS file: /home/ncvs/src/lib/libc/stdio/vfprintf.c,v >retrieving revision 1.20 >diff -u -r1.20 vfprintf.c >--- vfprintf.c 1998/09/16 04:17:44 1.20 >+++ vfprintf.c 1999/02/20 10:20:08 >@@ -545,7 +545,10 @@ > flags |= SHORTINT; > goto rflag; > case 'l': >- flags |= LONGINT; >+ if (flags & LONGINT) >+ flags |= QUADINT; >+ else >+ flags |= LONGINT; > goto rflag; > case 'q': > flags |= QUADINT; >@@ -1016,7 +1019,10 @@ > flags |= SHORTINT; > goto rflag; > case 'l': >- flags |= LONGINT; >+ if (flags & LONGINT) >+ flags |= QUADINT; >+ else >+ flags |= LONGINT; > goto rflag; > case 'q': > flags |= QUADINT; This assumes that long longs have the same representation as quad_t's. I suppose not doing a global change from quad_t to long long is best, because the change should actually be to C9x's intmax_t to support C9x's %m formats. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message