[GiNaC-list] Usage of designated initializer in factor.cpp forces c++20 on GiNaC
Igor Machado
igor.machado at gmail.com
Sun Oct 1 00:57:15 CEST 2023
Dear all, congratulations for this amazing software.
I was struggling a little bit to make it work in CMake, with many linking
errors in windows (for linux it was easy, but I need both working) so I
recently created a simple Bazel build file for the projects CLN and GINAC,
to debug the error.
In the end, I managed to find and fix the error, so I wanted you to know
that the file factor.cpp from GiNaC is using designated initializers, which
is only part of c++20... and when I activated c++20 here, the linking was
broken on windows! So, a solution was to change (around line 2344):
factorization_ctx ctx = {.poly = poly, .x = x, .syms_wox = syms_wox};
And transform into this:
factorization_ctx ctx{poly, x, syms_wox};
After that, I can enable c++17 and it works on GCC, Clang and MSVC! For GCC
and Clang, they don't complain on designated initializers, even if it's
c++17 standard...
So, since it's the only thing from c++20, you should consider if it's work
activating a whole new standard just because of this, or to consider that
the project is already c++20.
I personally love c++20, but it's important to notice that some fundamental
things change... for example, I just discovered that the code works in
c++20 in windows, but with /permissive flag, otherwise it gives crazy
LNK2019 linking errors. I believe some ABI has changed after c++17, but it
was hard to understand and fix the error.
So, best regards and I hope this information is useful!
Igor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ginac.de/pipermail/ginac-list/attachments/20230930/ba7639fc/attachment.htm>
More information about the GiNaC-list
mailing list