lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


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