Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: sys/clock.h



Hi Jan,

Jan Schaumann wrote:

> > It looks like in order to be able to use sys/clock.h,
> > one needs to first include either inttypes.h or
> > stdint.h _before_ sys/clock.h.
> > 
> > I've long made it a habit of sorting includes
> > alphabetically and according to /usr/share/misc/style,
> > which requires 'sys' includes to come before others,
> > but that leads to
> > 
> > /usr/include/sys/clock.h:72:14: error: unknown type name 'uint64_t'
> >    72 | is_leap_year(uint64_t year)
> >       |              ^~~~~~~~
> > /usr/include/sys/clock.h:84:15: error: unknown type name 'uint64_t'
> >    84 | days_per_year(uint64_t year)
> >       |               ^~~~~~~~
> > 
> > Should sys/clock.h itself include the headers it
> > actually needs for the inline function implementations
> > it provides?
>
> Per tnn@'s suggestion, does the attached diff look ok?

+#if !defined(_KERNEL) && !defined(_STANDALONE)
+#include <stdint.h>
+#endif

Sorry for chiming in late.  Wouldn't it be better to include
<sys/stdint.h> and avoid the #ifdef?  Especially since <stdint.h>
is a symlink to <sys/stdint.h> .

Cheers,
Simon.


Home | Main Index | Thread Index | Old Index