[tz] question regarding 'timezone' variable

Robert Elz kre at munnari.OZ.AU
Mon Aug 31 12:54:50 UTC 2015

    Date:        Mon, 31 Aug 2015 11:11:15 +0000
    From:        Kees Dekker <Kees.Dekker at infor.com>
    Message-ID:  <858F859BB4F2824EBAB5D4ED58214CB7011DEBF87B at NLBAWEXMBX3.infor.com>

  | Question: Is behavior intended? Or do I miss something?

Technically I think you may be right - but the general rule for C (at
least on unix like systems) is that uninitialised global variables are
handled like fortran common blocks (if that means anything) - which means
they can be declared as many times as needed, they all refer to the same
object (with the same name of course) and there's no one single defining
reference (though there can be, if one is initialised).

C doesn't (or didn't in the early days) guarantee that - it depended on the
system's linker, but unix ld works that way.

So ...

   a.   The provided variable in localtime.c may conflict with the system one.

It won't.   Of course, other things might conflict if you somehow get the
system's localtime and the one from the tzcode linked into the same binary.

   b.   The used variable in strftime.c may not related to the variable
        in localtime.c

It will be the same thing.


More information about the tz mailing list