Le 2014-09-09 13:43, [email protected] a écrit :
Rémi Denis-Courmont <[email protected]> writes:

Le 2014-09-09 10:48, [email protected] a écrit :
Wouldn't it be more robust to check the return value of
clock_gettime?
Should give errno == EINVAL for clocks that aren't available.

Why would it be more robust?

Because you can generate some suitable error message if the clock is
missing due to some misconfiguration or other error.

And how is that more robust than checking once? It's merely slower.

The clock cannot "go away". And even if it did, the error would be non-recoverable, since all timing values would be lost.

Always checking
return values is a bit annoying, but it's usually the right thing to do.

I must disagree. Handling impossible errors typically is worse than not handling them.

Also, you really want to probe the clock once and use the same result
always.

You could check the return value for every call, and stop using it if it fails (which clearly will be the first call, in any normal situation).

How is that any different than checking the clock the official way the first time, except for being slower and creating impossible error cases?

--
Rémi Denis-Courmont
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to