- usage of std::format instead of boost::format
std::regex instead of boost::regex
std::bind instead of boost::bind (though, I use lambda functions, because I found them to be much faster)
std::isnan instead of boost::math::isnan
std::filesystem instead of boost::filesystem
usage of [[maybe_unused]] or Q_UNUSED, since, it's Qt (also, [[likely]], [[unlikely]] etc.)
and many more, like std::span - creation of portable version of FreeCAD. I know that there is "portable" version, but it's only called like that.
Usage of C++20/23
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Usage of C++20/23
What do venerable developers think about usage C++20/23?
Re: Usage of C++20/23
already discussed.
There are work to modernize codebase, however main problem seems to be the different ways compilers implement new features that is sparse across different OS as FreeCAD should compile 'at least' on Windows, MacOS and Linux and each of them has a different C++ compiler.
Regards
Carlo D.
There are work to modernize codebase, however main problem seems to be the different ways compilers implement new features that is sparse across different OS as FreeCAD should compile 'at least' on Windows, MacOS and Linux and each of them has a different C++ compiler.
Regards
Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.
Blog: https://okkmkblog.wordpress.com/
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.
Blog: https://okkmkblog.wordpress.com/
Re: Usage of C++20/23
I could not find discussion on this topic. Could you provide me a link?
Re: Usage of C++20/23
The move to C++20 is not yet possible because we still have to support older systems that don't have full-featured C++20 compilers. For more information see also viewtopic.php?t=72173What do venerable developers think about usage C++20/23?
Using std::format and friends was also on my wish list but that's one of the C++20 features that is not supported on older systems. So the alternative is to use the fmtlib that provides the needed functionality.usage of std::format instead of boost::format
Nope. This is one of the things we must not change because it's known that std::regex is up to 60x slower than boost::regex.std::regex instead of boost::regex
https://github.com/FreeCAD/FreeCAD/pull/1713
Yes, replacing boost::bind is fine.std::bind instead of boost::bind (though, I use lambda functions, because I found them to be much faster)
I didn't even know that this exists. Since it has been added with C++11 it's fine to change it.std::isnan instead of boost::math::isnan
This library has actually been added with C++17 but we postponed the change because it was not fully supported on older systems with a C++17 compiler. So, this should be discussed again.std::filesystem instead of boost::filesystem
We partially use this already. Further options are std::ignore (but there are different opinions whether it should be used in this context) or boost::ignore_unusedusage of [[maybe_unused]] or Q_UNUSED, since, it's Qt (also, [[likely]], [[unlikely]] etc.)
Is also a C++20 feature.and many more, like std::span
What would be the difference from a technical point of view?creation of portable version of FreeCAD. I know that there is "portable" version, but it's only called like that.
Re: Usage of C++20/23
Thanks for this comprehensive reply, there is much to think of.
The link you provided says that the language is C++17 with some C++20 features. std::span, three-way comparison operator, attributes [[likely]], [[unlikely]], [[maybe_unused]] and [[nodiscard]] are supported by GCC 10 supplied with Ubuntu 18.04, which support ends in 2023-04. mingw-w64 v10 (GCC 13) still supports Windows 7, which is minimal Windows version.
A portable version of FreeCAD is always good for usage on another computer and, of course, α- and β-testing.
The link you provided says that the language is C++17 with some C++20 features. std::span, three-way comparison operator, attributes [[likely]], [[unlikely]], [[maybe_unused]] and [[nodiscard]] are supported by GCC 10 supplied with Ubuntu 18.04, which support ends in 2023-04. mingw-w64 v10 (GCC 13) still supports Windows 7, which is minimal Windows version.
A portable version of FreeCAD is always good for usage on another computer and, of course, α- and β-testing.
Re: Usage of C++20/23
Ubuntu 18.04 is no longer the reference. We have decided for Ubuntu 20.04 as the minimum version.supplied with Ubuntu 18.04, which support ends in 2023-04
Xubuntu 18.04 was my previous system and due to moves to newer versions of some libs (e.g. Python, Qt) or tools (e.g. cmake) I have moved to Xubuntu 22.04.
Of course but my question was more about how to create such a portable version compared to what we have now.A portable version of FreeCAD is always good for usage on another computer and, of course, α- and β-testing.
Re: Usage of C++20/23
Every compilation log is filled with warnings about deprecation of iterators and set-but-not-used variables in SALOME's MESH code, taking 2500 lines of output. -Wdeprecated-declarations and -Wunused-but-set-variable will eliminate all of them. Perhaps, addition of [[maybe_unused]] is a sound approach, nevertheless, rewriting of iterators is a totally different thing.
The question how to create a portable version of FreeCAD is beyond my area of expertise, though, I hope, there are still developers who know.
The question how to create a portable version of FreeCAD is beyond my area of expertise, though, I hope, there are still developers who know.
- adrianinsaval
- Veteran
- Posts: 5551
- Joined: Thu Apr 05, 2018 5:15 pm
Re: Usage of C++20/23
IIRC we don't have full mingw support, msvc is the baseline for these decisions, don't know what version.
the portability thing then has nothing to do with c++ 20? I recommend not mixing topics in the same forum thread, it can get confusing and hard to follow.
Re: Usage of C++20/23
This should not be true, @wmayer and I did some work in this area last year and last time I checked it worked well. Maybe something has changed in the interim?
Re: Usage of C++20/23
I considered creation of two topics on two small questions was not right. Feel free to create another topic where we will move our discussion.adrianinsaval wrote: ↑Sat Feb 04, 2023 8:27 pmthe portability thing then has nothing to do with c++ 20? I recommend not mixing topics in the same forum thread, it can get confusing and hard to follow.
I still stand for what I wrote. Every output log is completely filled with warnings about deprecated features and unused variables. Their removal will clear the compilation log, facilitating analysis.
I saw these two messages (one, posted by you, and two) on "portable" version. I still think actual portable version of FreeCAD is a good idea.