| 1 | = !MapGuide RFC 172 - Adopt C++11 as the minimum compiler language version = |
| 2 | |
| 3 | This page contains a change request (RFC) for the !MapGuide Open Source project. |
| 4 | More !MapGuide RFCs can be found on the [wiki:MapGuideRfcs RFCs] page. |
| 5 | |
| 6 | == Status == |
| 7 | |
| 8 | ||RFC Template Version||(1.0)|| |
| 9 | ||Submission Date||23 May 2019|| |
| 10 | ||Last Modified||23 May 2019|| |
| 11 | ||Author||Jackie Ng|| |
| 12 | ||RFC Status||draft|| |
| 13 | ||Implementation Status|||| |
| 14 | ||Proposed Milestone||3.0|| |
| 15 | ||Assigned PSC guide(s)||(when determined)|| |
| 16 | ||'''Voting History'''||(vote date)|| |
| 17 | ||+1|||| |
| 18 | ||+0|||| |
| 19 | ||-0|||| |
| 20 | ||-1|||| |
| 21 | ||no vote|| || |
| 22 | |
| 23 | == Overview == |
| 24 | |
| 25 | This RFC proposes to switch to |
| 26 | [http://en.wikipedia.org/wiki/C%2B%2B11 C++11] compilation mode as |
| 27 | default throughout the whole C++ source code of MapGuide. |
| 28 | |
| 29 | The goal of this RFC is to request and achieve agreement on using |
| 30 | C++11 as the minimum required version of the C++ programming language |
| 31 | standard. |
| 32 | |
| 33 | == Motivation == |
| 34 | |
| 35 | C++11 is the first major update of the C++ standard since 1998. (?C++03 was a bug fix release.) |
| 36 | |
| 37 | Having fewer versions of C++ to support will reduce the load on developers and testing systems. |
| 38 | |
| 39 | C++11 features aim to promote writing clean, compact, type-safe and fast code. It also delivers better feature-wise compatibility with the C language (C99). |
| 40 | |
| 41 | The Wikipedia article at ?http://en.wikipedia.org/wiki/C++11 does a great job describing all changes in C++11 extensively. |
| 42 | |
| 43 | The std::auto_ptr smart pointer, together with a bunch of other features, were deprecated and will be removed from C++17. Features like std::unique_ptr provide much stronger replacements. |
| 44 | |
| 45 | Enabling C++11 compilation mode will improve the programming environment making it much friendlier than C++98. |
| 46 | |
| 47 | A social factor: since (many) C++ programmers no longer enjoy C++98, allowing C++11 mode may increase potential for new contributions. |
| 48 | |
| 49 | From a purely-MapGuide perspective: |
| 50 | |
| 51 | * Establishing C++11 as the baseline puts us in a place to finally take advantage of some libraries which we couldn't in the past (hindering development of some new features as a result) as those libraries themselves require a C++11 compliant compiler to build. |
| 52 | * Also FDO implicitly now requires a C++11 compliant compiler on Linux anyways due to the removal of boost and replacing them with C++11 standard library features (eg. `std::mutex`), so it make some sense to be on the same page regarding the expected C++ standards compilation mode. |
| 53 | |
| 54 | == Compilers Landscape == |
| 55 | |
| 56 | Summary of compilers supported by GDAL with their minimal versions |
| 57 | required to compile source code based on |
| 58 | |
| 59 | http://en.cppreference.com/w/cpp/compiler_support C++11 features. |
| 60 | |
| 61 | === C++11 === |
| 62 | |
| 63 | ||GCC ||4.8.1+ ||[https://gcc.gnu.org/projects/cxx-status.html#cxx11 C++11 status] ||Debian 8 (stable), Ubuntu 15.04+, Ubuntu 14.04 `ppa:ubuntu-toolchain-r/test`, Fedora 19+, RHEL7 || |
| 64 | ||Clang||3.3+ ||[https://clang.llvm.org/cxx_status.html#cxx11 C++11 status] ||Debian 8 (stable), Ubuntu 14.04+, Fedora 19+, CentOS 6(?)|| |
| 65 | ||MSVC ||14.0+ (2015)||[https://msdn.microsoft.com/en-us/library/hh567368.aspx C++11 status]||n/a|| |
| 66 | |
| 67 | === C++14 === |
| 68 | |
| 69 | The C++14 compilers are listed for comparison only: |
| 70 | |
| 71 | ||GCC ||4.9+ || |
| 72 | ||Clang||3.4+ || |
| 73 | ||MSVC ||14.0+ (2015)|| |
| 74 | |
| 75 | == Proposed Solution == |
| 76 | |
| 77 | Windows: No changes required. |
| 78 | |
| 79 | Linux/CMake: The CMake build will set default compiler flags to build in C++11 standards mode. |
| 80 | |
| 81 | Actual porting of the MapGuide codebase to take advantage of C++11 language features and constructs is not in the scope of this RFC. This RFC is merely seeking consensus that we should now require a C++11 compliant compiler as a minimum requirement to build MapGuide. |
| 82 | |
| 83 | The porting of the codebase will be an on-going activity done after adoption of this RFC. |
| 84 | |
| 85 | == Implications == |
| 86 | |
| 87 | Windows is not impacted, we will not make any compiler settings changes. |
| 88 | |
| 89 | When compiling on Linux, a C++11-compliant compiler is now required. |
| 90 | |
| 91 | == Test Plan == |
| 92 | |
| 93 | Verify existing test suites still pass on Linux after activating C++11 compilation mode. |
| 94 | |
| 95 | == Funding / Resources == |
| 96 | |
| 97 | Community |