[Top][All Lists]

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

libgettext.h (Re: Documentation of ngettext)

From: Alexandre Duret-Lutz
Subject: libgettext.h (Re: Documentation of ngettext)
Date: 06 Dec 2001 15:01:36 +0100
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/21.1

>>> "Bruno" == Bruno Haible <address@hidden> writes:


 Bruno> You get all this in a single line through #include "libgettext.h",
 Bruno> using the libgettext.h from gettext-0.10.40.

I'm discovering this file.  It defines:

|# define gettext(Msgid) (Msgid)
|# define dgettext(Domainname, Msgid) (Msgid)
|# define dcgettext(Domainname, Msgid, Category) (Msgid)
|# define ngettext(Msgid1, Msgid2, N) \
|    ((N) == 1 ? (char *) (Msgid1) : (char *) (Msgid2))
|# define dngettext(Domainname, Msgid1, Msgid2, N) \
|    ((N) == 1 ? (char *) (Msgid1) : (char *) (Msgid2))
|# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \
|    ((N) == 1 ? (char *) (Msgid1) : (char *) (Msgid2))
|# define textdomain(Domainname) ((char *) (Domainname))
|# define bindtextdomain(Domainname, Dirname) ((char *) (Dirname))
|# define bind_textdomain_codeset(Domainname, Codeset) ((char *) (Codeset))

Those `(char *)' casts will cause warnings everytime I use a
litteral string.

I believe they are here to mimic the return type of these
functions (then they are missing in the two first macros).  

Yet, as all the man pages say: the return type is `char *' for
hysterical reasons but it ought to be `const char *'.  Anyone
relying on the output of ngettext (for instance) being mutable
is likely to introduce a bug.

I suggest removing all these casts.

Alexandre Duret-Lutz

reply via email to

[Prev in Thread] Current Thread [Next in Thread]