c/6547: misleading printf '$' format
Joseph S. Myers
jsm28@cam.ac.uk
Fri May 3 06:47:00 GMT 2002
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
More information about the Gcc-bugs
mailing list