On Monday, December 10, 2012, Howard Hinnant wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Dec 10, 2012, at 2:50 AM, Saleem Abdulrasool <<a href="javascript:;" onclick="_e(event, 'cvml', 'compnerd@compnerd.org')">compnerd@compnerd.org</a>> wrote:<br>
<br>
> Use the _LIBCPP_CONSTEXPR macro to allow the preprocessor to determine if<br>
> constexpr should be applied to the constructor. This is required to unify the<br>
> constructor definition.<br>
><br>
> Unify the constructor declarations, moving the member variable initialisation<br>
> into the initialiser-list. This requires an ugly C-style cast to ensure<br>
> portability across all implementations. PTHREAD_{MUTEX,COND}_INITIALIZER may be<br>
> an aggregate initialiser, which requires an explicit type conversion for the<br>
> compound literal.<br>
><br>
> <a href="http://llvm-reviews.chandlerc.com/D194" target="_blank">http://llvm-reviews.chandlerc.com/D194</a><br>
><br>
> Files:<br>
> include/__mutex_base<br>
><br>
> Index: include/__mutex_base<br>
> ===================================================================<br>
> --- include/__mutex_base<br>
> +++ include/__mutex_base<br>
> @@ -37,13 +37,9 @@<br>
> pthread_mutex_t __m_;<br>
><br>
> public:<br>
> - _LIBCPP_INLINE_VISIBILITY<br>
> -#ifndef _LIBCPP_HAS_NO_CONSTEXPR<br>
> - constexpr mutex() _NOEXCEPT : __m_(PTHREAD_MUTEX_INITIALIZER) {}<br>
> -#else<br>
> - mutex() _NOEXCEPT {__m_ = (pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER;}<br>
> -#endif<br>
> - ~mutex();<br>
> + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR mutex() _NOEXCEPT<br>
> + : __m_((pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER) {}<br>
> + ~mutex();<br>
><br>
> private:<br>
> mutex(const mutex&);// = delete;<br>
> @@ -303,12 +299,8 @@<br>
> {<br>
> pthread_cond_t __cv_;<br>
> public:<br>
> - _LIBCPP_INLINE_VISIBILITY<br>
> -#ifndef _LIBCPP_HAS_NO_CONSTEXPR<br>
> - constexpr condition_variable() : __cv_(PTHREAD_COND_INITIALIZER) {}<br>
> -#else<br>
> - condition_variable() {__cv_ = (pthread_cond_t)PTHREAD_COND_INITIALIZER;}<br>
> -#endif<br>
> + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR condition_variable()<br>
> + : __cv_((pthread_cond_t)PTHREAD_COND_INITIALIZER) {}<br>
> ~condition_variable();<br>
><br>
> private:<br>
> <D194.1.patch>_______________________________________________<br>
> cfe-commits mailing list<br>
> <a href="javascript:;" onclick="_e(event, 'cvml', 'cfe-commits@cs.uiuc.edu')">cfe-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
<br>
Is this change just for stylistic reasons, or is it required to get something working?</blockquote><div><br></div><div> It is simply a stylistic/cleanup change. There should be no change in functionality.<span></span></div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Howard<br>
<br>
</blockquote><br><br>-- <br>Saleem Abdulrasool<br>compnerd (at) compnerd (dot) org<br>