Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #72951

Re: A printf question.

From MehdiAmini <atorrses@gmail.com>
Newsgroups comp.lang.c
Subject Re: A printf question.
Date 2015-10-15 14:06 +0000
Organization A noiseless patient Spider
Message-ID <mvobsa$lf8$1@dont-email.me> (permalink)
References <mvkh2q$58k$1@dont-email.me>

Show all headers | View raw


In reply to "James Kuyper" who wrote the following:

[...]

> True - but diagnostics are always permitted. The OP seems to be be
> concerned about whether a diagnostic is mandatory for this code. It's
> not clear whether he's asking why this particular compiler fails to
> generate the diagnostic that he thought was mandatory, or whether he's
> asking why there's no text in the standard making a diagnostic
> mandatory. In the former case, it would belpful to know which rule he
> thinks is violated by this code; in the latter case, it would be helpful
> to know what rule he thinks should be added to the standard.
> --
> James Kuyper

After writing the original code, I found the following text in K&R:

"
A warning: printf uses its first argument to decide how many arguments follow 
and what their type is. It will get confused,
and you will get wrong answers, if there are not enough arguments of if they are 
the wrong type. You should also be aware of
the difference between these two calls:
printf(s); /* FAILS if s contains % */
printf("%s", s); /* SAFE */
"



-- 
--------------------------------- --- -- -
Posted with NewsLeecher v7.0 Beta 7
Web @ http://www.newsleecher.com/?usenet
------------------- ----- ---- -- -

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

A printf question. MehdiAmini <atorrses@gmail.com> - 2015-10-13 14:09 +0000
  Re: A printf question. Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-10-13 10:46 -0400
  Re: A printf question. Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-10-13 09:19 -0700
    Re: A printf question. Keith Thompson <kst-u@mib.org> - 2015-10-13 10:45 -0700
      Re: A printf question. David Brown <david.brown@hesbynett.no> - 2015-10-13 23:15 +0200
  Re: A printf question. James Kuyper <jameskuyper@verizon.net> - 2015-10-13 15:25 -0400
    Re: A printf question. glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-10-14 02:55 +0000
      Re: A printf question. James Kuyper <jameskuyper@verizon.net> - 2015-10-13 23:12 -0400
        Re: A printf question. supercat@casperkitty.com - 2015-10-14 06:34 -0700
          Re: A printf question. Keith Thompson <kst-u@mib.org> - 2015-10-14 10:26 -0700
        Re: A printf question. MehdiAmini <atorrses@gmail.com> - 2015-10-15 14:06 +0000
          Re: A printf question. James Kuyper <jameskuyper@verizon.net> - 2015-10-15 10:26 -0400
      Re: A printf question. Noob <root@127.0.0.1> - 2015-10-25 23:02 +0100

csiph-web