From 8d34828f2506365238508a68751f6ae02e8e201c Mon Sep 17 00:00:00 2001 From: Audun Wilhelmsen Date: Mon, 28 Apr 2014 13:38:26 -0700 Subject: [PATCH] Added section on unsigned integers --- Nimrod-for-C-programmers.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Nimrod-for-C-programmers.md b/Nimrod-for-C-programmers.md index e9faf78..5c7386d 100644 --- a/Nimrod-for-C-programmers.md +++ b/Nimrod-for-C-programmers.md @@ -75,6 +75,12 @@ Nimrod arrays can also be indexed from any number. That is, ``z: array[1..4, int In C, there's nothing that stops you from keeping a pointer to a stack-allocated array after the function that declared it has returned (and the stack is invalidated). In Nimrod, this is true as well, but you are strongly discouraged from using pointers in Nimrod, and you can accomplish almost everything you'd otherwise use pointers for with normal arguments, "var" arguments, variables, and "ref". +### Unsigned integers + +Nimrod strongly discourages the use of unsigned integers, as it's considered unnecessary and somewhat unsafe* for most applications. The unsigned types uint, uint8/16/32/64 are available by default, but the arithmetic and binary functions are not defined. If you do need to do arithmetic on unsigned integers, you need to import the **unsigned** module. + +*See: http://critical.eschertech.com/2010/04/07/danger-unsigned-types-used-here/ + ### Structs - Tuples and Objects Tuples and Objects in Nimrod are kind of like structs in C, but not really.