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: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Niklas Holsti Newsgroups: comp.lang.ada Subject: Re: Text_IO, was: Re: Something I don't understand Date: Tue, 18 Feb 2014 08:56:05 +0200 Organization: Tidorum Ltd Message-ID: References: <4a3e55f6-9f54-4084-9f37-96efd4b0d349@googlegroups.com> <0b358700-871b-4603-addd-65e07c7d59e5@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: individual.net Kou569nQg6NnRghG1aHMUAPZU/QpCJMDcp1cryJT0cT2dnN4/O Cancel-Lock: sha1:sqYG3D4TaafWyMECYCh9ZkDgT1c= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 In-Reply-To: Xref: news.eternal-september.org comp.lang.ada:18653 Date: 2014-02-18T08:56:05+02:00 List-Id: On 14-02-18 02:50 , Simon Clubley wrote: > On 2014-02-17, Niklas Holsti wrote: >> This invites errors in matching the fragments in the format string with >> the variables in the variable sequence, just as in current >> template-based systems e.g. C. You add a variable, but forget to add the >> format fragment, et cetera. With the current method using string >> concatenation, the format parameters are automatically associated with >> the right variable, being parameters in the same Image call. >> > > That could be caught at compilation time because there would be a > mismatch between the format string and the number of variables. Only if the format string is a static constant, which would be rather limiting. > I wonder if it's possible to do something along the lines of gcc > which looks at the printf format string during compilation and > complains, during compilation, if there's a mismatch detected in > data types. Again, that works only when the format string is a constant, which is limiting. Some of that limitation can be worked around in C by using the '*' character in place of a numerical field width or precision, but that would be more yucky again -- some variables in the list would now configure the format string, instead of being output, and one would have to count and match up the format fragments and the variables in the list to find out which is which. -- Niklas Holsti Tidorum Ltd niklas holsti tidorum fi . @ .