NetBSD Problem Report #3527

Received: (qmail-queue invoked from smtpd); 24 Apr 1997 16:10:02 -0000
Message-Id: <199704241609.LAA03873@marvin.ece.utexas.edu>
Date: Thu, 24 Apr 1997 11:09:54 -0500 (CDT)
From: bgrayson@ece.utexas.edu
Reply-To: bgrayson@ece.utexas.edu
To: gnats-bugs@gnats.netbsd.org
Subject: *printf(3) and %lld
X-Send-Pr-Version: 3.95

>Number:         3527
>Category:       standards
>Synopsis:       printf(3) doesn't mention that %lld is equivalent to %q
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    misc-bug-people
>State:          closed
>Class:          doc-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Apr 24 09:20:01 +0000 1997
>Closed-Date:    Mon Sep 14 21:01:35 +0000 1998
>Last-Modified:  Mon Sep 14 21:03:00 +0000 1998
>Originator:     Brian Grayson
>Release:        April 20, 1997
>Organization:
	Parallel and Distributed Systems
	Electrical and Computer Engineering
	The University of Texas at Austin
>Environment:
System: NetBSD marvin 1.2D NetBSD 1.2D (MARVIN) #24: Wed Apr 23 09:29:29 CDT 1997 root@data:/a/orac/home/orac/src/sys/arch/i386/compile/MARVIN i386


>Description:
	The man page for printf() and friends mentions the use of
	a single 'l' modifier, and also mentions the %q format.
	However, it does not mention that _two_ 'l's can be used
	to specify a 'long long'.  In other words, %lld is
	equivalent to %q.

	I don't know whether the use of 'll' is POSIX or ANSI or
	whatever, but it's a little more portable than %q, in my
	very-limited experience (i.e., %lld works on an
	UltraSparc around here, but %q doesn't, and neither works
	on an AIX box we have).

>How-To-Repeat:
	Look at the source code:
	  /usr/src/lib/libc/stdio/vfprintf.c, around line 369,
	  shows that if an 'l' is encountered, and if the next
	  character is also an 'l', QUADINT is set.

>Fix:
	Here's a patch to the man page.  Someone in-the-know
	ought to add a note about which is preferred for
	NetBSD-only source (presumably %q), and which is more
	likely to be portable (%lld?  I really don't know), etc.
--- printf.3    Thu Apr 24 10:52:13 1997
+++ printf.3.mod        Thu Apr 24 11:01:15 1997
@@ -346,6 +346,31 @@
 conversion corresponds to a pointer to a
 .Em long int
 argument.
+.Bl -hyphen
+.It
+If two consecutive
+.Cm l
+(ell) characters are used, a following 
+.Cm d ,
+.Cm i ,
+.Cm o ,
+.Cm u ,
+.Cm x ,
+or
+.Cm X
+conversion applies to a pointer to a
+.Em long long int (quad int)
+or
+.Em unsigned long long int (unsigned quad int)
+argument, or that a following
+.Cm n
+conversion corresponds to a pointer to a
+.Em long long int (quad int)
+argument.
+.\"  Which is preferred, %q or %lld?  Which is more likely to be
+.\"  portable?  Is this worth discussing here?
+.El
+
 .It
 The optional character
 .Cm q ,
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: tv 
State-Changed-When: Mon Sep 14 14:01:35 PDT 1998 
State-Changed-Why:  
Fixed in -current. 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.