1<?xml version="1.0" encoding="UTF-8"?> 2<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" 3"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"> 4<section id="safe_numerics.notes"> 5 <title>Background</title> 6 7 <para>This library started out as a re-implementation of the facilities 8 provided by <ulink url="http://safeint.codeplex.com">David LeBlanc's SafeInt 9 Library</ulink>. I found this library to be well done in every way. My main 10 usage was to run unit tests for my embedded systems projects on my PC. 11 Still, from my perspective it had a few issues.</para> 12 13 <itemizedlist> 14 <listitem> 15 <para>It was a lot of code in one header - 6400 lines. Very unwieldy to 16 understand, modify and maintain.</para> 17 </listitem> 18 19 <listitem> 20 <para>I couldn't find separate documentation other than that in the 21 header file.</para> 22 </listitem> 23 24 <listitem> 25 <para>It didn't use <ulink url="http://www.boost.org">Boost</ulink> 26 conventions for naming.</para> 27 </listitem> 28 29 <listitem> 30 <para>It required porting to different compilers.</para> 31 </listitem> 32 33 <listitem> 34 <para>It had a very long license associated with it.</para> 35 </listitem> 36 37 <listitem> 38 <para>I could find no test suite for the library.</para> 39 </listitem> 40 </itemizedlist> 41 42 <para>Using later versions of C++ and the its standard library, template 43 metaprogramming and <ulink url="http://www.boost.org">Boost 44 libraries</ulink> I managed to (re)implement similar functionality in under 45 2000 ? lines of code. I promoted this version as a possible submission to 46 the Boost. The feedback I received convinced me that no such library would 47 be considered acceptable to the large majority of C++ programmers. It seems 48 that the desire for maximum performance overrides any requirement that a 49 program be known to be free of bugs. By this time I had a better idea of the 50 opportunities available with the latest version of C++ (C++14) and resolved 51 to address this issue by creating a library which would provide all the 52 facilities of safe numerics at minimal runtime cost. The result is what you 53 see here. The library now consists of 7000 lines of code, approximately 50 54 separate tests and more than 60 pages of documentation and examples.</para> 55 56 <para>Since I wrote the above, I've been contacted by David LeBlanc. He's 57 been updating his package and informs me that the latest 58 version:<itemizedlist> 59 <listitem> 60 <para>SafeInt does not require porting for different compilers, is 61 fully supported on gcc, clang, and Visual Studio.</para> 62 </listitem> 63 64 <listitem> 65 <para>The license has been changed from MS-PL to MIT license.</para> 66 </listitem> 67 68 <listitem> 69 <para>The library has had a test suite since before it was public, and 70 is now located here:</para> 71 </listitem> 72 73 <listitem> 74 <para>SafeInt also has no external dependencies other than standard 75 library files, and doesn't need anything else installed to 76 work.</para> 77 </listitem> 78 </itemizedlist></para> 79 80 <para>His current package can now be found at in <ulink 81 url="https://github.com/dcleblanc/SafeInt">github</ulink>.</para> 82</section> 83