jkriege2 / JKQtPlotter

an extensive Qt5 & Qt6 Plotter framework (including a feature-richt plotter widget, a speed-optimized, but limited variant and a LaTeX equation renderer!), written fully in C/C++ and without external dependencies
http://jkriege2.github.io/JKQtPlotter/index.html
GNU Lesser General Public License v2.1
864 stars 187 forks source link

C++ 20 #138

Open sim186 opened 3 days ago

sim186 commented 3 days ago

Hi Jan,

I was trying to switch my project to C++20 standard, do you know if there are issues using the standard with the library? I am getting a crash but I am not sure if the problem is on my side. Looks like that something has changes with the management of the un-initialized variables.

Do you have an idea? Thanks

jkriege2 commented 3 days ago

In principle it should work (and I think it worked, at least half a year ago) ... I added a C++20-build to the Appveyor-build ... and will test it again locally.

BTW: You can set the CMake-option "JKQtPlotter_ENABLED_CXX20=ON", which should activate some C++20-features in the code (e.g. use of std::format())... and it will require at least C++20 as a c++-standard-version for the CMake-build.

I'll let you know what further tests transpire ...

jkriege2 commented 3 days ago

locally on my desktop (Windows) I was able to build JKQTPlotter using C++20 with either MinGW64 or MSVC64 against Qt 6.7.2. Also some of the examples were working ...

jkriege2 commented 3 days ago

What kind of error do you get?

Snolandia commented 3 days ago

Running c++20 on my qt build. Builds and starts fine, though I do get a random crash presumable due to an uninitialized variable somewhere. I had changed the project from a previous version to 20 not too long ago, but its not clear if the crash was related to the version change or not.

Its not clear to me whether my crash is relevant to the Master Branch or my custom setup. I have not been able to reliably cause the crash so determining the cause has not been fruitful. To make it worse, the crash will not happen if I am running in debug mode, though the crash does happen with the debug build, while not in debug mode.

Are you able to reliably get it to crash? And at what point does it crash?

jkriege2 commented 2 days ago

No, for me it works in the tests I ran ...

Snolandia commented 2 days ago

No, for me it works in the tests I ran ...

I meant sim186.

sim186 commented 2 days ago

What kind of error do you get?

Hi. I get the crash in the addGraph call. The funny this as @Snolandia said in release configuration is working fine. As soon I get to the problem I try to give you more information.

Snolandia commented 2 days ago

What kind of error do you get?

Hi. I get the crash in the addGraph call. The funny this as @Snolandia said in release configuration is working fine. As soon I get to the problem I try to give you more information.

No, I havent tried it in release configuration.

Debug config, building and running without it actually being in debug mode is where i get the crash. Debug config, building and running with it being in debug mode, I cant get the crash to happen.

You say you get the crash in addGraph call, do you have anything initialized as a nullptr? Ive run into crashes when I initialize certain things as nullptr's and Qt does not like it.

jkriege2 commented 15 hours ago

I played around a bit with adress-sanitizer (in MSVC), but couldn't find any issues with several of the examples ... neither with C++20, nor with C++17 ...