[vlc-devel] [PATCH] Added check for _Static_assert and C++11 static_assert.

Maxim Bublis b at codemonkey.ru
Mon Dec 9 13:53:19 CET 2013

> > I would really like to merge this patch. Are there any reasons not to do
> so?
> Wouldn't adding -Dstatic_assert=_Static_assert to CPPFLAGS be enough
> until Apple fixes assert.h ?

I've done some research recently, and would like to share results with you.

1) As you know, VLC partially written in C and C++. We have two recent
standards for both languages: C11 and C++11.
C++11 defines static_assert as **keyword**, and it is
implementation-defined, therefore compiler should support it.
Recent versions of clang++ supports it with -std=c++11 flag. No include
C11 defines static_assert as macro in assert.h. _Static_assert is
**implementation-defined** and should be supported by compiler.
Recent versions of clang supports _Static_assert. No include requires.

2) Apple ships standard libraries for both languages with XCode
distribution, but they are rather inconsistent.
Standard C++ library defines static_assert in case compiler doesn't support
it (e.g. trying to compile without -std=c++11 flag).
Standard C library lacks of definition for static_assert in <assert.h>.

Maxim Bublis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20131209/cee91b94/attachment.html>

More information about the vlc-devel mailing list