public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: "Pierre-Canalsat PETIT" <pierrecanalsat.petit.canalsat@canal-plus.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, Subject: Re: c/6547: misleading printf '$' format Date: Fri, 03 May 2002 07:26:00 -0000 [thread overview] Message-ID: <20020503142601.14399.qmail@sources.redhat.com> (raw) The following reply was made to PR c/6547; it has been noted by GNATS. From: "Pierre-Canalsat PETIT" <pierrecanalsat.petit.canalsat@canal-plus.com> To: jsm28@cam.ac.uk Cc: gcc-bugs@gcc.gnu.org, gcc-gnats@gcc.gnu.org, Joseph Myers <jsm28@srcf.ucam.org>, peio@blutch.dyndns.org, prpetit@canal-plus.com Subject: Re: c/6547: misleading printf '$' format Date: Fri, 3 May 2002 16:18:13 +0200 > 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. ====(forgot to answer to all...)==== True.. I forgot that, thanks. So gcc-3.0 has no misleading warning, good point (maybe a more verbose warning should be written..). Note v2.95.4 still has one : #include <stdio.h> int main(int argc, char *argv[]) { printf("%2$.*1$s\n", argc, *argv); return 0; } This gives a "warning: unknown conversion type character '1' in format" ====(Snap)==== There is still a problem it seems on gcc v3.0.4.. : #include <stdio.h> #include <string.h> int main(int argc, char *argv[]) { printf("Usage: %1$s [-n <option 1>] [-m <option 2>]\n" " %3$*2$c [-i <input>] [-o <output>] [-c <nb>] [-t <ms>]\n" " %3$*2$c <file.in> <file.out>\n", *argv, strlen(*argv), ' '); return 0; } This returns me a "warning: too few arguments for format". But if you remove the second line of the format, it does compile without warning... -- Pierre PETIT
next reply other threads:[~2002-05-03 14:26 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2002-05-03 7:26 Pierre-Canalsat PETIT [this message] -- strict thread matches above, loose matches on Subject: below -- 2002-08-23 13:16 jsm28 2002-05-03 13:26 Joseph S. Myers 2002-05-03 6:56 Joseph S. Myers 2002-05-03 6:06 peio
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20020503142601.14399.qmail@sources.redhat.com \ --to=pierrecanalsat.petit.canalsat@canal-plus.com \ --cc=gcc-prs@gcc.gnu.org \ --cc=nobody@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).