Changes between Version 3 and Version 4 of BestPracticeHandbook


Ignore:
Timestamp:
May 4, 2015, 11:47:08 AM (7 years ago)
Author:
Niall Douglas
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • BestPracticeHandbook

    v3 v4  
    8484
    8585
    86 == 2. Consider making it possible to use an XML outputting unit testing framework, even if not enabled by default ==
     86== 2. Very strongly consider versioning your library's namespace ==
     87
     88== 3. Strong consider trying your library on Microsoft Visual Studio 2015 ==
     89
     90More than half the libraries reviewed had no support for Microsoft Visual Studio, and only supported GCC and clang. When the authors were asked why, in many cases it was simply assumed that MSVC didn't implement much C++ 11/14 and the authors hadn't attempted MSVC support.
     91
     92This is in fact untrue. Here is a complete list of C++ 11/14 features which VS2015 does '''NOT''' support (everything else you can assume it supports, including a full and complete C++ 14 STL):
     93
     94* Expression SFINAE (there are workarounds. Note the STL "turns on" magic Expression SFINAE support for those parts of the STL requiring it, so any Expression SFINAE done by the STL for you works as expected).
     95* Any serious constexpr use (try "#define constexpr" i.e. disable it completely. Most of the time your code will compile and work. Consider using a BOOST_CONSTEXPR macro thereafter). It is claimed by Microsoft that full C++ 11 constexpr conformance is present, but to be honest in my own code I don't find anything less than C++ 14 constexpr useful in practice.
     96* No two phase lookup. Reordering decls to make the compiler look up in a way which doesn't produce non-conforming outcomes is a straightforward, if annoying, workaround.
     97* MSVC's C99 support is still less than complete, but it's significantly more complete than before.
     98* MSVC's preprocessor is still non-conforming, but it's less broken than it has ever been.
     99* Variable templates.
     100* Non-static data member initialisers for aggregates.
     101
     102VS2015 is a very highly conforming C++ 11/14 compiler. It meets or exceeds clang 3.3 on every C++ feature. VS2015 even has some support for C++ 1z (C++ 17) matching clang 3.5. See http://blogs.msdn.com/b/vcblog/archive/2015/04/29/c-11-14-17-features-in-vs-2015-rc.aspx.
     103
     104I am not claiming that you won't get surprises when you try getting MSVC to compile your code which you thought was standards compliant. MSVC is not an AST based compiler and uses heuristics to trigger partial AST compilation, and therefore has a unique processing model which exposes your assumptions about what you think or thought is valid C++. This is exactly why it is worthwhile getting your C++ 11/14 library working on MSVC because you will get a better quality, more standards conforming C++ library out of it.
     105
     106== 4. Consider making it possible to use an XML outputting unit testing framework, even if not enabled by default ==
    87107
    88108A very noticeable trend in C++ 11/14 mandatory Boost libraries is that less than half are able to use Boost.Test, and use alternative unit testing systems.
     
    92112TODO IN PROGRESS
    93113
    94 == 3. Consider trying your library on Microsoft Visual Studio 2015 ==
    95 
    96 == 4. Consider versioning your library's namespace ==
    97 
    98114== 5. Consider not doing compiler feature detection yourself ==