This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]