diff --git a/changelog/std-experimental-checkedint.dd b/changelog/std-experimental-checkedint.dd new file mode 100644 index 00000000000..5c8216e3273 --- /dev/null +++ b/changelog/std-experimental-checkedint.dd @@ -0,0 +1,21 @@ +New: Checked, a lightweight and highly configurable checked integral + +$(REF Checked, std, experimental, checkedint) is a wrapper around any integral +type that inserts checks against common sources of bugs: overflow in operators, +mixed-sign comparisons, and casts that lose information. + +The example below illustrates the basic use of the facility: + +------- +void main() +{ + import std.experimental.checkedint, std.stdio; + writeln((checked(5) + 7).get); // 12 + writeln((checked(10) * 1000 * 1000 * 1000).get); // Overflow +} +------- + +By default, all checks are enabled and the program is aborted if any check +fails. An implementation based on hooks discoverable by using Design by +Introspection allows unbounded customizations of both the checks to do, and the +enforcement policy.