First proposal for new ISO C 9x time API

Garrett Wollman wollman at khavrinen.lcs.mit.edu
Sun Sep 6 01:43:55 UTC 1998


<<On Sat, 5 Sep 1998 14:16:54 -0700 (PDT), Paul Eggert <eggert at twinsun.com> said:

[quoting others]
>> It would be a good idea to use a common prefix for the structure elemen=
>    ts
>> (xtm_nsec, xtm_sec, etc.).

>    I never understood what these common prefixes are good for.

> I believe that they were put in for historical reasons.  In very old
> versions of the C compiler, all structure members lived in the same
> name space.

They still survive for a very good non-historical reason: in all
versions of the C preprocessor, all macros live in the same name
space.  Using unique prefixes such as these makes it possible for the
vendor to change the underlying representation and patch things up
using preprocessor macros.  (Putting on my vendor hat here, just to
give one example: when some loser in P1003 decided to rename the
`struct timespec' fields to use a `tv_' prefix instead of `ts_', it
was trivial to create macro glue which would accept both draft and
standard forms.  In a hypothetical non-prefixing world, if said loser
had decided to rename `nsec' to `nanosec', we would have been totally
out of luck.)

-GAWollman

--
Garrett A. Wollman   | O Siem / We are all family / O Siem / We're all the same
wollman at lcs.mit.edu  | O Siem / The fires of freedom 
Opinions not those of| Dance in the burning flame
MIT, LCS, CRS, or NSA|                     - Susan Aglukark and Chad Irschick



More information about the tz mailing list