[Development] <version> (was: Re: C++20 @ Qt)

Giuseppe D'Angelo giuseppe.dangelo at kdab.com
Sat Nov 12 14:32:19 CET 2022


Il 10/11/22 09:25, Marc Mutz via Development ha scritto:
> 
> unconditionally and we will detect post-C++17 library features only this
> way, going forward:
> 
>     #ifdef __cpp_lib_foo
>     # include <foo>
>     #endif
> 
> and no longer this way:
> 
>     #if __has_include(<foo>) && __cplusplus > 201703L
>     #  include <foo>
>     #endif
> 
> To not break existing uses, however, existing checks that do the
> __has_include dance should not be cleaned up before we require the resp.
> library feature unconditionally.

Hi,

I'm not sure if this has been explicitly discussed, but a prerequisite 
for this scheme to work is that compiler vendors *do not* define library 
feature macros inside <version> that you cannot use in the current C++ 
version. In other words, having the proposed:

#if __cpp_some_cpp23_feature
# include <cpp23_feature>
#endif

is never going to blow up with some #error inside the included header 
when compiling in pre-C++23 mode. I'm guessing that's always the case, 
right?

Thanks,

-- 
Giuseppe D'Angelo | giuseppe.dangelo at kdab.com | Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
KDAB - The Qt, C++ and OpenGL Experts

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4244 bytes
Desc: Firma crittografica S/MIME
URL: <http://lists.qt-project.org/pipermail/development/attachments/20221112/42f40e54/attachment.bin>


More information about the Development mailing list