[PATCH] Define CLOCKS_PER_SEC type to the type clock_t

Paul Eggert eggert@cs.ucla.edu
Tue Jan 6 04:47:00 GMT 2015


H.J. Lu wrote:
> assert (CLOCKS_PER_SEC == 1000000l);

This fails only at runtime if the value is wrong, which is not as good as 
checking it at compile-time.  Something like this, perhaps:

#if __STDC_VERSION__ < 201112L
# define _Static_assert(e, s) extern int (*static_assert_checker (void)) \
     [sizeof (struct { unsigned int error_if_negative: (e) ? 1 : -1; })]
#endif
#define verify(e) _Static_assert (e, "verify (" #e ")")

and then use 'verify' instead of 'assert'.

Also, there's no need for the trailing 'l' here.



More information about the Libc-alpha mailing list