Jean-Michaël Celerier wrote:

> Hello,
> 
> At the ned of this mail is a patch that adds generation of a macro for
> the relaxed ("c++14") constexpr in WriteCompilerDetectionHeader.

Thanks for working on this.

I have some thoughts for archival purposes on the mailing list. These aren't 
things you necessarily need to address:

 * I think I've read about constexpr being made even more relaxed in a 
future CXX standard. Would we then call it 'yet_more_relaxed_constexpr'? 
Clang, whose names CMake follows, likely won't introduce a name for it 
because it will likely start to rely on SD-6 macros instead of extending 
__has_feature. SD-6 doesn't have that problem because it would just use a 
new value for the __cpp_constexpr macro (which already has two possible 
values 200704 and 201304).
 * The 'relaxed' name is already what is currently used for this feature. 
Future developments don't really matter.
 * It's appropriate for this macro to expand to empty if 
cxx_relaxed_constexpr is not available, because a function marked constexpr 
which is only cxx11-constexpr but not cxx14-constexpr will fail to compile 
anyway. Programmers are aware of ways to implement methods in a way that is 
cxx11-constexpr, even if making it cxx14-constexpr would be more 
easy/readable.
* A method marked constexpr will fail to compile with a compiler which does 
not support relaxed constexpr if the method uses language which requires 
relaxed mode (such as a for loop), even if the method is evaluated in a non-
constant expression. I tested GCC and Clang.

So assuming all that is correct, I think this patch is good. 

I think there should be a test for the different allowed contexts of the 
${prefix_arg}_RELAXED_CONSTEXPR and ${prefix_arg}_CONSTEXPR macros. Could 
you extend Tests/Module/WriteCompilerDetectionHeader with a test for that?

Thanks,

Steve.

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to