aboutsummaryrefslogtreecommitdiffstats
path: root/docs/source/lang/cpp/unsignedlong.rst
diff options
context:
space:
mode:
authorMarti Bolivar <mbolivar@mit.edu>2010-12-21 10:27:37 -0500
committerMarti Bolivar <mbolivar@mit.edu>2010-12-21 10:27:37 -0500
commitc45bccad44187da27505cf5808424e709e3f54a1 (patch)
tree18a459a50f8d0551ba046e30462c93999d982725 /docs/source/lang/cpp/unsignedlong.rst
parent84fd2532a7f23d20354ff590790b3f892cb7e7d7 (diff)
parentd5ad2a27f4e69e6cc9324331945937c983c30366 (diff)
downloadlibrambutan-c45bccad44187da27505cf5808424e709e3f54a1.tar.gz
librambutan-c45bccad44187da27505cf5808424e709e3f54a1.zip
Merge branch 'master' into debug-serialusb.
Chose debug-serialusb version in cases of conflict. Conflicts: libmaple/usb/usb_callbacks.c
Diffstat (limited to 'docs/source/lang/cpp/unsignedlong.rst')
-rw-r--r--docs/source/lang/cpp/unsignedlong.rst41
1 files changed, 41 insertions, 0 deletions
diff --git a/docs/source/lang/cpp/unsignedlong.rst b/docs/source/lang/cpp/unsignedlong.rst
new file mode 100644
index 0000000..14a4fc3
--- /dev/null
+++ b/docs/source/lang/cpp/unsignedlong.rst
@@ -0,0 +1,41 @@
+.. highlight:: cpp
+
+.. _lang-unsignedlong:
+
+``unsigned long``
+=================
+
+An unsigned version of the :ref:`long <lang-long>` data type. An
+``unsigned long`` occupies 8 bytes of memory; it stores an integer
+from 0 to 2^64-1, which is approximately 1.8×10^19 (18 quintillion, or
+18 billion billion).
+
+Like an :ref:`unsigned int <lang-unsignedint>`, an ``unsigned long``
+won't store negative numbers; it is also subject to the same
+:ref:`overflow issues <lang-int-overflow>` as any integral data type.
+
+Here is an example of declaring an ``unsigned long`` variable named
+``c``, then giving it value 299,792,458,000,000,000 (see :ref:`integer
+constants <lang-constants-integers-u-l>` for an explanation of the "L"
+at the end of the number)::
+
+ // Speed of light in nanometers per second (approximate).
+ unsigned long c = 299792458000000000L;
+
+The general syntax for declaring an ``unsigned long`` variable named
+``var``, then giving it value ``val``, looks like::
+
+ unsigned long var = val;
+
+See Also
+--------
+
+- :ref:`long <lang-long>`
+- :ref:`int <lang-int>`
+- :ref:`unsigned <lang-unsignedint>`
+- :ref:`char <lang-char>`
+- :ref:`unsigned char <lang-unsignedchar>`
+- :ref:`Integer Constants <lang-constants-integers>`
+- :ref:`Variables <lang-variables>`
+
+.. include:: cc-attribution.txt