[GRASS-dev] G_gettext initialization

Glynn Clements glynn at gclements.plus.com
Thu Nov 16 09:15:07 EST 2006


Brad Douglas wrote:

> In G_gettext (lib/gis/locale.c), I ran across this code:
> 
> char *
> G_gettext(const char *package, const char *msgid)
> {
> #if defined(HAVE_LIBINTL_H) && defined(USE_NLS)
>     static char now_bound[4096];
>     static int initialized;
> 
>     if (!initialized)
>     {
>         ...
>         initialized = 1;
>     }
> ...
> }
> 
> Is there any particular reason that 'initialized' is not actually
> initialized?  Is there a reason for this?

I don't understand what you are asking; can you elaborate?

The above is a common idiom used to perform "one-shot" initialisation
the first time that a function is called.

-- 
Glynn Clements <glynn at gclements.plus.com>




More information about the grass-dev mailing list