This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c/6547: misleading printf '$' format
- From: "Joseph S. Myers" <jsm28 at cam dot ac dot uk>
- To: <peio at blutch dot dyndns dot org>
- Cc: <gcc-gnats at gcc dot gnu dot org>, <prpetit at canal-plus dot com>, <gcc-bugs at gcc dot gnu dot org>
- Date: Fri, 3 May 2002 14:47:23 +0100 (BST)
- Subject: Re: c/6547: misleading printf '$' format
On 3 May 2002 peio@blutch.dyndns.org wrote:
> With both v2.95 and 3.0, there is a warning on "%.*1$s":
> "warning: unknown conversion type character '1' in format"
> >How-To-Repeat:
> #include <stdio.h>
>
> int main (int argc, char *argv[]) {
> printf("%.*s == %2$.*1$s\n", argc, *argv);
You can't mix $ and non-$ formats in one format string; see the Single
Unix Specification. Once a non-$ format is detected, $ operand numbers
are no longer checked for. Note that "%." can only be the start of a
non-$ format.
--
Joseph S. Myers
jsm28@cam.ac.uk