Proposal: API for thread-safe time zone functions

Garrett Wollman wollman at khavrinen.lcs.mit.edu
Fri Jun 8 15:29:15 UTC 2001


<<On Fri, 8 Jun 2001 16:10:59 +0100, "Clive D.W. Feather" <clive at demon.net> said:

> So in foo.h write the one line:

>     typedef struct timezone timezone_t;

So it's perfectly OK for me to also write:

	typedef struct __sFILE FILE;

...in my headers as well?

You know very well that this is not portable.  The implementation
(which controls <timezone.h> in the scenario we're discussing) might
choose to define timezone_t some other way -- perhaps they make it a
`union __timezone *' instead.  Even if it were standardized, this
would still break when an application actually needed <timezone.h> and
my declaration in <foo.h> became redundant.  In any case, only a
faulty standard would declare that `timezone_t' is always a `struct
timezone'.  A good standard would not have a `timezone_t' to begin
with.

(In the FreeBSD Project, and probably many other places, our coding
standard is very explicit: don't use typedefs for structures.  This
deficiency in C is precisely the reason for making that requirement.)

-GAWollman




More information about the tz mailing list