Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 Apr 2004 13:40:26 -0700 (PDT)
From:      Wartan Hachaturow <wart@tepkom.ru>
To:        freebsd-standards@FreeBSD.org
Subject:   Re: standards/65779: Potential bug in printf positional parameters
Message-ID:  <200404192040.i3JKeQtP073285@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR standards/65779; it has been noted by GNATS.

From: Wartan Hachaturow <wart@tepkom.ru>
To: freebsd-gnats-submit@FreeBSD.ORG
Cc:  
Subject: Re: standards/65779: Potential bug in printf positional parameters
Date: Tue, 20 Apr 2004 00:28:06 +0400

 (sorry, misspelled gnats address in the last letter)
 
 On Mon, Apr 19, 2004 at 03:18:47PM -0400, Jonathan McGee wrote:
 
 > A minimum test case was written and attached (test-libc.c).  When built, four
 > integers (1, 2, 3, 4) are passed to a positional printf that should display
 > them in order, skipping the second.
 
 This is not a bug.
 To quote SUSv3
 (http://www.opengroup.org/onlinepubs/007904975/functions/fprintf.html):
 
 "When numbered argument specifications are used, specifying the Nth
 argument requires that all the leading arguments, from the first to the
 (N-1)th, are specified in the format string."
 
 Furthemore, man 3 printf says:
 
 "Arguments are numbered starting at 1.  If unaccessed arguments
  in the format string are interspersed with ones that are accessed 
  the results will be indeterminate."
 
 .. which is just what you get.
 
 -- 
 Regards, Wartan.
 "Be different: conform."



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200404192040.i3JKeQtP073285>