Subject: misc/3527: *printf(3) and %lld
To: None <>
From: None <>
List: netbsd-bugs
Date: 04/24/1997 11:09:54
>Number:         3527
>Category:       misc
>Synopsis:       printf(3) doesn't mention that %lld is equivalent to %q
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    misc-bug-people (Misc Bug People)
>State:          open
>Class:          doc-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Apr 24 09:20:01 1997
>Originator:     Brian Grayson
	Parallel and Distributed Systems
	Electrical and Computer Engineering
	The University of Texas at Austin
>Release:        April 20, 1997
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

	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).

	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.
	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
+.Bl -hyphen
+If two consecutive
+.Cm l
+(ell) characters are used, a following 
+.Cm d ,
+.Cm i ,
+.Cm o ,
+.Cm u ,
+.Cm x ,
+.Cm X
+conversion applies to a pointer to a
+.Em long long int (quad int)
+.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)
+.\"  Which is preferred, %q or %lld?  Which is more likely to be
+.\"  portable?  Is this worth discussing here?
 The optional character
 .Cm q ,