Added section on unsigned integers

This commit is contained in:
Audun Wilhelmsen 2014-04-28 13:38:26 -07:00
parent c416256f15
commit 8d34828f25
1 changed files with 6 additions and 0 deletions

View File

@ -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.