[PATCH weston 01/12] shared: Add timespec_is_zero helper
Emil Velikov
emil.l.velikov at gmail.com
Fri Nov 24 18:36:43 UTC 2017
Hi Alexandros,
On 16 November 2017 at 16:20, Alexandros Frantzis
<alexandros.frantzis at collabora.com> wrote:
> +ZUC_TEST(timespec_test, timespec_is_zero)
> +{
> + struct timespec zero = { 0 };
> + struct timespec non_zero_sec = { 1, 0 };
> + struct timespec non_zero_nsec = { 0, 1 };
> +
The standard (be that POSIX or C99) does not guarantee the layout of
the struct. Hence the above approach may work, but it's a bad idea.
Personally I'm a fan of C99 designated initializers, although one
could set the tv_sec and tv_nsec individually.
Same comment applies through the rest of the series.
HTH
Emil
More information about the wayland-devel
mailing list