Building with C++ version less than 20

Jörg Dommaschk j.dommaschk at instar.com
Thu Aug 24 21:00:16 PDT 2023


Hello, 

I have recently built live555 from the latest version and was greeted with a compilation error, namely: 

BasicTaskScheduler.cpp:191:40: error: 'struct std::atomic_flag' has no member named 'test' 

This happens because that member test of std::atomic_flag has only been added with C++20. That is a bit unfortunate, since there are projects out there that use an older standard and updating is not always trivial, especially when cross compiling is involved. Of course this issue can be quickly resolved by building live555 with NO_STD_LIB defined, but I think a more "automatic" solution would be nice. 

Ideally that whole atomic logic would be implemented simply without using C++20 exclusive features. But if this is not possible, then maybe we could at least check for the version. So something like 

#ifndef NO_STD_LIB && __cplusplus >= 202002L 
//code using std::atomic_flag 
#else 
//the old logic 
#endif 

Maybe there could even be a warning/info during configuration/build informing the user that their C++ version is too low, something like "your C++ version is x, so you will only get the old, potentially buggy logic, please consider updating to C++20". 

Thanks and regards 
Jay 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20230825/a35b623e/attachment.htm>


More information about the live-devel mailing list