Update technical todo

Add a section mentioning C++20 and the new constexpr
std::string and std::vector that we can use.
This commit is contained in:
Ian McInerney 2020-01-21 11:02:17 +00:00
parent 10a862c458
commit 752bc5b7ba
2 changed files with 14 additions and 4 deletions

View File

@ -29,6 +29,9 @@ the version switch exists and can be tidied.
## C++14 {#todo_cpp_14} ## C++14 {#todo_cpp_14}
This C++ standard version is already used by KiCad on the development branch, but much code
that pre-dates this version can be tidied.
Compiler support: Compiler support:
* GCC: complete by GCC 5: [GCC C++14 support](https://gcc.gnu.org/projects/cxx-status.html#cxx14). * GCC: complete by GCC 5: [GCC C++14 support](https://gcc.gnu.org/projects/cxx-status.html#cxx14).
@ -48,6 +51,12 @@ Provides:
can replace `boost::filesystem` and the Boost dependency can be dropped entirely can replace `boost::filesystem` and the Boost dependency can be dropped entirely
from the CMake files. from the CMake files.
## C++20 {#todo_cpp_20}
* `constexpr std::string` and `constexpr std::vector` can be used to initialize items:
* File extensions in `wildcards_and_files_ext.h`
# Compilers {#compilers} # Compilers {#compilers}
Some compilers have bugs or limitations to C++ standard support. Some compilers have bugs or limitations to C++ standard support.

View File

@ -91,10 +91,11 @@ enum {
static const std::map<int, supportedFileType>& fileTypes() static const std::map<int, supportedFileType>& fileTypes()
{ {
/* /*
* This is wrapped inside a function to prevent a static initialization order fiasco with the file extension * TODO(C++20): Clean this up
* variables. Once C++20 is allowed in KiCad code, those file extensions can be made constexpr and this can * This is wrapped inside a function to prevent a static initialization order fiasco with the file extension
* be removed from a function call and placed in the file normally. * variables. Once C++20 is allowed in KiCad code, those file extensions can be made constexpr and this can
*/ * be removed from a function call and placed in the file normally.
*/
static const std::map<int, supportedFileType> fileTypes = static const std::map<int, supportedFileType> fileTypes =
{ {
{ ID_PANEL_FPLIB_ADD_KICADMOD, { "KiCad (folder with .kicad_mod files)", "", KiCadFootprintFileExtension, false, IO_MGR::KICAD_SEXP } }, { ID_PANEL_FPLIB_ADD_KICADMOD, { "KiCad (folder with .kicad_mod files)", "", KiCadFootprintFileExtension, false, IO_MGR::KICAD_SEXP } },