[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Why does string.format() limit width to two digits?
- From: bil til <biltil52@...>
- Date: Thu, 19 Jan 2023 08:05:30 +0100
Am Mi., 18. Jan. 2023 um 22:27 Uhr schrieb Andreas Falkenhahn
<andreas@falkenhahn.com>:
>
> Personally not but I think for reasons of portability it would be
> nice if Lua's string.format() behaved the same as the C specification
> (where possible). As I said, I noticed this because some code I was
> porting from C used more than two digits and I was surprised that it
> failed with Lua.
Can you give a C code example?
... the "(where possilbe)" is a very "flexible" restriction (wide
interpretation field...) ... printf / sprintf really is a wellknown
and infamous drawback of C, e. g. new versions of Visual C compiler
use many "bizarre tricky techniques" to reveal possible printf errors
(but mostly such errors arrive of course because of the possibility to
mix pointers and numbers in the "flexible argument list" - this anyway
clearly is impossible in Lua).