On Saturday, 6 May 2023 at 10:44:17 UTC+1 Matt wrote:
I think I have a great solution for our limited callback functionality that is compatible with C++98, but how can I test that? It uses some extensive and unreadable macros and requires __VA_ARGS__, which was only "standardised" in C++99, but most older compiler "just had it".
Anyway, the solution is a header-only file that generates more complex callbacks on the fly, so simply not including the header would keep full compatibility.
My question is, is there any way to test if my code would compile on old compilers? Or should I just merge it, and we will wait for feedback?
How far back do we want to go?
Greg maybe still has MSVC-6 for example?
On the gcc side, I think anything since about gcc-4 should be fine with that, IIRC.
Older gcc versions might be more dubious, but they would most likely be from before the various gcc C++ ABI changes, so unlikely to still be used anyway...
As regards the gcc C++ binary changes: As I recall it (i.e. I didn't check this!) the C++ ABI changed at the transition from gcc-2.95 to gcc-3, and then again at about gcc-3.3 or thereabouts. It's been pretty stable since and generally compatible going forwards.
There were some systems locked into the older ABI though - I think the BeOS / Haiku folks were locked into the old gcc-2.95 ABI (thought I think Haiku added a compatibility layer later to use newer tools) and vxWorks-5 was tied to a "gcc-2.96" ABI, which I think was their port of the last supported 2.95 version. (VxWorks-6 shipped with gcc-4.3, and that was "long ago" now anyway.)
Other than that, I'd assume most platforms have tools "modern enough" to make it work... anything that does not is likely to be pretty niche (like emulating the ABI of the Apple Newton, say) so we'd likely never be able to test it anyway.