From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: buffer2.nntp.dca1.giganews.com!border2.nntp.dca1.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!goblin3!goblin.stu.neva.ru!news-1.dfn.de!news.dfn.de!news.informatik.hu-berlin.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Niklas Holsti Newsgroups: comp.lang.ada Subject: Re: Running a preprocessor from GPS? Date: Thu, 30 Jul 2015 16:55:52 +0300 Organization: Tidorum Ltd Message-ID: References: <2df4698f-4c8e-457c-822d-209cb2f8ab5e@googlegroups.com> <014427b1-ff7a-4a69-82e6-0330af77ed96@googlegroups.com> <1438244829.17005.26.camel@obry.net> <0a8104af-4ebb-4d82-92e5-6ba7289272ce@googlegroups.com> <13bslomh3tahk$.62kmnpkj0wge$.dlg@40tude.net> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net 8nx84BuT4/neLPI2yr2JVAMenO7RVM2M2+4w16ON7joujLrTUD Cancel-Lock: sha1:U07qJ/1+7MLoI2hwMKSlkQPKYw4= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 In-Reply-To: <13bslomh3tahk$.62kmnpkj0wge$.dlg@40tude.net> Xref: number.nntp.giganews.com comp.lang.ada:194517 Date: 2015-07-30T16:55:52+03:00 List-Id: On 15-07-30 15:23 , Dmitry A. Kazakov wrote: > On Thu, 30 Jul 2015 04:51:48 -0700 (PDT), EGarrulo wrote: > >> Exactly! And: >> >> Printf ("Mr %Arg you have won %Arg dollars!\n", Surname, Amount); >> >> is much more readable than: > > It is not readable and it is not formatting, just string concatentation. > >> Put ("Mr "); >> Put (Surname); >> Put (" you have won "); >> Put (Amount); >> Put (" dollars!"); >> New_Line; > [snip] >> Not to mention that the order of the >> arguments is hard-coded in the valid Ada snippet, whilst you could >> need a different order to support formatted output in different >> languages. > > And how is it different from printf, except that printf has a hard-coded > order used twice rather than once (once in the format and once in the > arguments), adding a nice source of run-time errors... Some printf's support, in the "%" conversion specifications, an initial part of the form "%12$" to say that the argument to be converted is argument number 12 in the argument list. So the format string can pick the arguments in any order it wants -- even converting the same argument several times. (I did not find this feature in the C99 standard. I don't know how widely it is supported.) I don't have any experience of writing multilingual programs, but it seems to me that just supplying a language-specific format-string to printf is unlikely to be enough, even if this printf has this ability to pick arguments in any order. -- Niklas Holsti Tidorum Ltd niklas holsti tidorum fi . @ .