[vlc-devel] [PATCH] vlc_common: include <assert.h>

Rémi Denis-Courmont remi at remlab.net
Wed Mar 15 13:49:18 CET 2017

On March 15, 2017 11:07:57 AM GMT+02:00, "Filip Roséen" <filip at atch.se> wrote:
>Given that vlc_assert_unreachable relies on assert from <assert.h>,
>this header should be included in order to simplify usage of the
>A header that provides a wrapper should not mandate that other headers
>are included in order for that wrapper to be usable.
> include/vlc_common.h | 1 +
> 1 file changed, 1 insertion(+)
>diff --git a/include/vlc_common.h b/include/vlc_common.h
>index 6a75753dbf..91901124e7 100644
>--- a/include/vlc_common.h
>+++ b/include/vlc_common.h
>@@ -47,6 +47,7 @@
> #include <stdio.h>
> #include <inttypes.h>
> #include <stddef.h>
>+#include <assert.h>
> #ifndef __cplusplus
> # include <stdbool.h>
>vlc-devel mailing list
>To unsubscribe or modify your subscription options:

I disagree. It is bad practice to include headers in headers, as it makes for sloppy code and harder revectoring. Especially when you don't need it. BSD style is even more extreme: you have to include necessary headers before dependent headers. So this situation is not really exceptional.

That is also the point in using a macro rather than an a static inline.
Rémi Denis-Courmont

More information about the vlc-devel mailing list