[Live-devel] Building with C++ version less than 20
Jörg Dommaschk
j.dommaschk at instar.com
Mon Aug 28 03:16:01 PDT 2023
Ok, I blew some dust off a macbook and saw a similar behavior as the one you reported: Even though __cplusplus gets printed as 199711, I can compile code using C++20 features. After some more research, I am under the impression that this macro is not as reliable as I thought it was, as different compiler vendors seem to have differing levels of adherence to its specification.
I am now also under the impression that reliably checking for whether one can use certain C++20 features like atomic_flag::test or not would be quite a hassle with all the different compilers and operating systems. Too much of a hassle for such a little quality of live improvement, so I concede at this point. Sorry to everyone compiling live555 on older systems and stumping over it not compiling out of the box (because this is really something that happens, and not due to some "bug on my side". I tested on Ubunutu 20.04, where C++ is only supported up to version 17). Again, if anyone stumbles upon this thread through google after having this problem: Compile with NO_STD_LIB.
Thanks for your patience and have a nice day.
----- Original Message -----
From: "Ross Finlayson" <finlayson at live555.com>
To: "LIVE555 Streaming Media, development & use" <live-devel at us.live555.com>
Sent: Monday, August 28, 2023 11:05:36 AM
Subject: Re: [Live-devel] Building with C++ version less than 20
> On Aug 27, 2023, at 7:55 PM, Jörg Dommaschk via live-devel <live-devel at us.live555.com> wrote:
>
> However, I am still not sure you are checking the version in the right way. Because what you posted looks like you redefine the macro somewhere in your code.
No, the code doesn’t redefine “__cplusplus” anywhere. In each of the two systems (FreeBSD and Mac OS X) that I tested, the compiler is telling me the value of “__cplusplus” (201402L and 199711L, respectively), and it’s telling me where it’s *defined* (not ‘redefined’) - in something called "<built-in>”.
> The __cplusplus macro just informs you about what the compiler uses.
And that’s what I’m reporting.
> If you really want to convince me, don't redefine it anywhere, just print it.
Again, that’s what I’m doing.
Ross Finlayson
Live Networks, Inc.
http://www.live555.com/
_______________________________________________
live-devel mailing list
live-devel at lists.live555.com
http://lists.live555.com/mailman/listinfo/live-devel
More information about the live-devel
mailing list