From 1569b9bd75b4f784bfd1cd8e323c073387ca0e38 Mon Sep 17 00:00:00 2001 From: Robert Ramey Date: Fri, 8 Nov 2013 08:14:45 -0800 Subject: [PATCH 1/3] Create README.md Arithmetic operations in C++ are NOT guarenteed to yield a correct mathematical result. This feature is inherited from the early days of C. The behavior of int, unsigned int and others were designed to map closely to the underlying hardware. Computer hardware implements these types as a fixed number of bits. When the result of arithmetic operations exceeds this number of bits, the result is undefined and usually not what the programmer intended. It is incumbent up the C++ programmer to guarentee that this behavior does not result in incorrect behavior of the program. This library implements special versions of these data types which behave exactly like the original ones EXCEPT that the results of these operations are checked to be sure that an exception will be thrown anytime an attempt is made to store the result of an undefined operation. Additionally, we define data types safe_signed_range and safe_unsigned_range which will throw an exception if an attempt is made to store a result which is outside the closed range [MIN, MAX] --- README.md | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..34fa5fb --- /dev/null +++ b/README.md @@ -0,0 +1,4 @@ +safe_numerics +============= + +C++ integral types silently ignore errors in assigment and type conversions. This library provides replacements which trap these errors on usage. From 087a913d6ce132d3317cbf212ea19e0926c4d11f Mon Sep 17 00:00:00 2001 From: Robert Ramey Date: Fri, 8 Nov 2013 08:28:14 -0800 Subject: [PATCH 2/3] Update README.md Arithmetic operations in C++ are NOT guarenteed to yield a correct mathematical result. This feature is inherited from the early days of C. The behavior of int, unsigned int and others were designed to map closely to the underlying hardware. Computer hardware implements these types as a fixed number of bits. When the result of arithmetic operations exceeds this number of bits, the result is undefined and usually not what the programmer intended. It is incumbent up the C++ programmer to guarentee that this behavior does not result in incorrect behavior of the program. This library implements special versions of these data types which behave exactly like the original ones EXCEPT that the results of these operations are checked to be sure that an exception will be thrown anytime an attempt is made to store the result of an undefined operation. Additionally, we define data types safe_signed_range and safe_unsigned_range which will throw an exception if an attempt is made to store a result which is outside the closed range [MIN, MAX] --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 34fa5fb..141e822 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,7 @@ safe_numerics ============= -C++ integral types silently ignore errors in assigment and type conversions. This library provides replacements which trap these errors on usage. +Arithmetic operations in C++ are NOT guarenteed to yield a correct mathematical result. This feature is inherited from the early days of C. The behavior of int, unsigned int and others were designed to map closely to the underlying hardware. Computer hardware implements these types as a fixed number of bits. When the result of arithmetic operations exceeds this number of bits, the result is undefined and usually not what the programmer intended. It is incumbent up the C++ programmer to guarentee that this behavior does not result in incorrect behavior of the program. This library implements special versions of these data types which behave exactly like the original ones EXCEPT that the results of these operations are checked to be sure that an exception will be thrown anytime an attempt is made to store the result of an undefined operation. + +Additionally, we define data types safe_signed_range and safe_unsigned_range which will throw an exception if an attempt is made to store a result which is outside the closed range [MIN, MAX] + From ea9d15cb1cb90c96f24af8391980302795d50f04 Mon Sep 17 00:00:00 2001 From: Robert Ramey Date: Fri, 8 Nov 2013 08:37:36 -0800 Subject: [PATCH 3/3] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 141e822..ff63738 100644 --- a/README.md +++ b/README.md @@ -5,3 +5,4 @@ Arithmetic operations in C++ are NOT guarenteed to yield a correct mathematical Additionally, we define data types safe_signed_range and safe_unsigned_range which will throw an exception if an attempt is made to store a result which is outside the closed range [MIN, MAX] +Browse documentation here