[Live-devel] Building with C++ version less than 20

Ross Finlayson finlayson at live555.com
Fri Aug 25 06:23:26 PDT 2023



> On Aug 25, 2023, at 2:42 AM, Jörg Dommaschk via live-devel <live-devel at us.live555.com> wrote:
> 
> 
> How do you define __cplusplus on your systems, though? Because as you can see here: 
> https://en.cppreference.com/w/cpp/atomic/atomic_flag
> this test method really only exists since C++20.

Nonetheless, on the two systems that I tested (FreeBSD and Mac OS X), __cplusplus is defined as follows (respectively):

<built-in>:377:21: note: expanded from here
#define __cplusplus 201402L

and

<built-in>:393:21: note: expanded from macro '__cplusplus'
#define __cplusplus 199711L

There might be a way to accurately check whether the “test()” member function is defined for "std::atomic_flag”, but checking "__cplusplus >= 202002L” is definitely not the right way to do so.  Sorry.


Ross Finlayson
Live Networks, Inc.
http://www.live555.com/




More information about the live-devel mailing list