Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C++17 #159

Open
1 of 2 tasks
marktsuchida opened this issue Feb 21, 2022 · 2 comments
Open
1 of 2 tasks

C++17 #159

marktsuchida opened this issue Feb 21, 2022 · 2 comments

Comments

@marktsuchida
Copy link
Member

marktsuchida commented Feb 21, 2022

We currently build all our C++ code with C++14 (#152). At some point we will want to move to C++17.

Unlike C++11/14, which are effectively backward compatible with correctly-written C++98/03, C++17 removes a few features. Here are the major ones that matter to our code:

Unfortunately, MMCoreJ currently uses exception specifiers, which are mapped to Java throws caluses by SWIG. While SWIG has alternative ways to specify this information, we will need to figure out a way to ensure that the MMCoreJ Java API does not change as we migrate. Also, we probably want to be using SWIG 4 before even getting started with this (see #37).

For this reason, I propose that we postpone a bulk switch to C++17 for the time being. If we successfully transition to individual C++ projects as outlined in micro-manager/micro-manager#1392, it will become trivial to enable C++17 (or even C++20) for individual projects as needed. (If absolutely needed, we might also be able to enable it for a particular device adapter under the current build systems, though it would be nice to avoid that if possible. Probably slightly better to make MMCoreJ the exception in that case.)

@marktsuchida
Copy link
Member Author

Note: The Visual Studio 2019 toolset (v142) that we currently use defaults to C++14 without an explicit /std:c++17 set in the project files. For macOS/Linux, the default C++ version is set in the configure.ac files.

@marktsuchida
Copy link
Member Author

#489 allows individual device adapters to switch to C++17 by doing the following:

  • In the Visual Studio project, set the project property General > C++ Language Standard to ISO C++ 17 Standard.
  • In Makefile.am, append -std=c++17 to AM_CXXFLAGS.

(For now, please only do this if your device adapter actually makes use of C++17 features.)

(Before #489, there was no way to avoid an error from GCC in C++17 mode and Clang required a special compiler flag.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant