Add timeradd() and timersub() to <sys/time.h>. [PSARC/2008/368 FastTrack timeout 06/16/2008]
Dan McDonald
danmcd at sun.com
Mon Jun 9 09:47:38 PDT 2008
On Mon, Jun 09, 2008 at 09:43:14AM -0700, Garrett D'Amore wrote:
> Mostly looks good. A few quick questions:
>
> lint will complain about a constant conditional for timeradd() and
> timersub(). Use of the /* LINTED */ comment before timeradd() or
> timersub() is recommended.
>
> Can't this be rectified in the header by use of #ifdef lint and some special
> lint-only version of the macros? I particularly dislike the cases where
> system headers (or system-supplied macros) make lint harder to use.
#ifdef lint seems to be the most expedient solution to the problem.
> Are macros the best way to add these? As opposed to inline functions or
> somesuch? (In particular, do we know if the other systems -- Linux and
> FreeBSD -- all implement these as macros?)
*BSD still has 'em as macros. Not sure about Linux -- feel free to look,
though.
> The various caveats with macros tend to make me want to shy away from their
> use in system headers, particularly where the intended consumers are the
> larger audience of general programmers. But if that's the way they are
> implemented everywhere else, then I suppose it won't hurt too badly to have
> them implemented as such as here.
I know for sure they're in BSD as macros.
> Are there any #define's to conditionally enable or disable these being
> added to the namespace? (I'm thinking along the lines of dialect options
> that the C compiler exports, e.g. __STDC__, _POSIX_C_SOURCE, and
> __EXTENSIONS__.)
That's why I went to Don Cragun first.
Three of the five documented were ALREADY IN sys/time.h. The two new ones
(timeradd/timersub) are in the same blocked areas as the first three.
> The other question (and this is just general, not architectural in nature)
> is, given that these functions seem to be widely useful and popular, are
> you aware of any movement in any of the standards bodies (POSIX) to
> standardize on these?
Ask Don -- that's his department.
Dan
More information about the opensolaris-arc
mailing list