Add timeradd() and timersub() to <sys/time.h>. [PSARC/2008/368 FastTrack timeout 06/16/2008]
James Carlson
james.d.carlson at sun.com
Mon Jun 9 09:49:44 PDT 2008
Don Cragun writes:
> void
> timeradd(struct timeval *a, struct timeval *b, struct timeval *res);
[...]
> int
> timercmp(struct timeval *a, struct timeval *b, CMP);
>
> int
> timerisset(struct timeval *tvp);
>
> void
> timersub(struct timeval *a, struct timeval *b, struct timeval *res);
It'd be nice to be able to make 'a', 'b', and 'tvp' const.
(Man, that "CMP" thing sure is evil ...)
> These macros are not available in function form. All of these macros
> evaulate their arguments more than once. If parameters passed to these
> macros are expressions with side effects, the results are undefined.
Except for timercmp, where the issue is obvious, it's unclear to me
why the others must be defined as function-like macros, especially as
ones with hidden side-effect warts.
> lint will complain about a constant conditional for timeradd() and
> timersub(). Use of the /* LINTED */ comment before timeradd() or
> timersub() is recommended.
Ick. Is there no way to fix that rather than just documenting it away?
--
James Carlson, Solaris Networking <james.d.carlson at sun.com>
Sun Microsystems / 35 Network Drive 71.232W Vox +1 781 442 2084
MS UBUR02-212 / Burlington MA 01803-2757 42.496N Fax +1 781 442 1677
More information about the opensolaris-arc
mailing list