[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gettext and C usage
From: |
Bruno Haible |
Subject: |
Re: gettext and C usage |
Date: |
Tue, 26 Feb 2002 14:38:24 +0100 (CET) |
Eli Zaretskii writes:
> > > #ifdef HAVE_LOCALE_H
> > > #include <locale.h>
> > > #endif
> >
> > Plain "#include <locale.h>" is sufficient. Systems without <locale.h>
> > file are not in use anymore.
>
> If so, then using HAVE_LOCALE_H cannoot possibly hurt, can it?
With useless #ifdefs, the program still compiles, sure. But it takes
half a second more at configure time to check for <locale.h>, and it
clutters the developer's sources.
> > > #if !HAVE_LC_MESSAGES
> > > # define LC_MESSAGES (-1)
> > > #endif
> >
> > Not needed. If <locale.h> doesn't define LC_MESSAGES, <libintl.h> will
> > do so. <libintl.h> is included by "gettext.h".
>
> But if ENABLE_NLS is not defined, then lib/gettext.h does not include
> libintl.h, at least the version of lib/gettext.h that is in
> texinfo-4.0i.tar.gz. So LC_MESSAGES will remain undefined.
You are right. OTOH, testing for !HAVE_LC_MESSAGES is wrong also,
because when ENABLE_NLS is defined (on platforms without LC_MESSAGES
in <locale.h>), then <libintl.h> will define its own LC_MESSAGES, and
you'd better use the same one. So this becomes
#ifndef LC_MESSAGES
# define LC_MESSAGES (-1)
#endif
Bruno