[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: printf is a crappy language in a crappy language (was Re: [OT] Lua community and Go language)
- From: Miles Bader <miles@...>
- Date: Tue, 20 Aug 2013 12:44:12 +0900
Tim Hill <drtimhill@gmail.com> writes:
> To my mind the worst thing about it is the implicit rather than
> explicit parameter indexing, which makes localization much harder
> (you can't change order in the format string to match language needs
> w/o changing the argument order to the call as well).
As I understand it, POSIX printf actually _does_ support explicit
parameter indexing (and I believe translation strings are indeed the
motivator for this).
I don't know how many printf implementations actually implement this
feature, but GNU libc certainly does.
E.g. the following program:
#include <stdio.h>
int main ()
{
printf ("%s, %s, %2$s, %1$s\n", "[arg 1]", "[arg 2]");
}
outputs:
[arg 1], [arg 2], [arg 2], [arg 1]
-miles
--
[|nurgle|] ddt- demonic? so quake will have an evil kinda setting? one that
will make every christian in the world foamm at the mouth?
[iddt] nurg, that's the goal
- References:
- [OT] Lua community and Go language, Lorenzo Donati
- Re: [OT] Lua community and Go language, Sven Olsen
- Re: [OT] Lua community and Go language, Gé Weijers
- Re: [OT] Lua community and Go language, Miles Bader
- Re: [OT] Lua community and Go language, Craig Barnes
- Re: [OT] Lua community and Go language, Rena
- Re: [OT] Lua community and Go language, Lorenzo Donati
- Re: [OT] Lua community and Go language, steve donovan
- printf is a crappy language in a crappy language (was Re: [OT] Lua community and Go language), Jay Carlson
- Re: printf is a crappy language in a crappy language (was Re: [OT] Lua community and Go language), William Ahern
- Re: printf is a crappy language in a crappy language (was Re: [OT] Lua community and Go language), Jay Carlson
- Re: printf is a crappy language in a crappy language (was Re: [OT] Lua community and Go language), Andres Perera
- Re: printf is a crappy language in a crappy language (was Re: [OT] Lua community and Go language), Jay Carlson
- Re: printf is a crappy language in a crappy language (was Re: [OT] Lua community and Go language), Andres Perera
- Re: printf is a crappy language in a crappy language (was Re: [OT] Lua community and Go language), Tim Hill