[Top][All Lists]

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

Re: [Jim Meyering] Re: [Bug-gnulib] strftime merge from Emacs

From: Paul Eggert
Subject: Re: [Jim Meyering] Re: [Bug-gnulib] strftime merge from Emacs
Date: 11 Jun 2003 10:29:34 -0700
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

Jason Rumney <address@hidden> writes:

> I wonder why you need to redeclare tzname[] there, do header files not
> already declare it on platforms where HAVE_TZNAME is defined?

Yes, depending on compilation options.  For example, I get the
following symptomps on both Debian GNU/Linux 3.0r1 and on Solaris 8:

   $ cat t.c
   #include <time.h>
   int main (void) { return !tzname; }
   $ gcc -c t.c
   $ gcc -c -ansi t.c
   t.c: In function `main':
   t.c:2: `tzname' undeclared (first use in this function)
   t.c:2: (Each undeclared identifier is reported only once
   t.c:2: for each function it appears in.)

This is because the C standard does not allow <time.h> to declare
tzname; a strictly conforming C program can declare its own variable
called 'tzname' with entirely different semantics.

Perhaps AC_STRUCT_TIMEZONE should also check whether tzname is
declared, and if so, define HAVE_DECL_TZNAME.  Then we could adjust
the code as follows:

#if HAVE_TZNAME && !HAVE_DECL_TZNAME && !defined tzname
extern char *tzname[];

reply via email to

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