2016-10-05 9:00 GMT+02:00 Maciej Izak <hnb.c...@gmail.com>:
>
> 2016-10-05 4:32 GMT+02:00 Michalis Kamburelis <michalis.ka...@gmail.com>:
>>
>> For example, the call
>>
>>   Format('%s', [123])
>
>
> I have a small hint (instead of answer). We have in mORMot / NewPascal in
> SynCommons module nice function which works perfect in most of cases:
>
> FormatUTF8('%', [123], []); // same string '%' works for both: integer and
> string values
> FormatUTF8('%', ['123'], []);
>

That's a cool improvement. No need to write the type, so one less
thing that can go wrong:) I seldom use non-standard formats anyway
(like %g instead of %f for floats).

Still, you can use an invalid number of arguments for FormatUTF8. So
you still have this uncomfortable feeling that "it's only checked at
runtime, while it could be checked earlier at lint / compile phase" :)

I'm leaning toward implementing a simple pascal-lint tool myself,
using the fcl-passrc. But to make it really useful on my real code,
I'll need some fixes to fcl-passrc first:)

Regards,
Michalis
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to