Daichi Kawahata wrote:
> from the above mentioned, if -Wformat=2 was used it's a
> "ngettext ("%u/%u host (%u%%)", "%u/%u hosts (%u%%)", max)" and
> "cur, max, frac"
> that will be checked at compile-time, isn't it? Also, I inserted
> the cpp macro in the src/commpn.h at 294-295:
> # define ngettext(Single, Plural, Number) \
> ((Number) == 1 ? (Single) : (Plural))GCC is clever enough so that it can check this at compile-time since it's transparent macro in contrast to a function interface. > gcc -c (snip) -O2 -W -Wall -Wformat=2 -g settings.c > settings.c: In function `set_host_progress': > settings.c:1098: warning: format not a string literal, argument > types not checked Well, this is unacceptable. ngettext() is certainly the proper way to handle the plural/singular problem but this means that we must not use format strings with ngettext(). So the affected format strings have to be re-arranged that the ngettext() result is a mere string argument - as discussed before this might require context information to the translatable strings. I assume this is no different from gettext() but GCC "trusts" the latter to not mess with format strings. > In my opinion, the language English has only singular and plural forms > per one noun (possibly), if those words were used in the source code at > once, there is nothing to do anymore. That was a misunderstanding. My manual page about ngettext() had a documentation bug which indicated that it works quite different. I understand that without NLS i.e., English only and the ngettext() macro, the behaviour is unchanged. -- Christian
pgpXl1WUfANFJ.pgp
Description: PGP signature
