Go Integers: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 7: Line 7:
Integers are designated by the following [[Go Concepts - Lexical Structure#Pre-Declared_Identifiers|pre-declared type identifiers]]:
Integers are designated by the following [[Go Concepts - Lexical Structure#Pre-Declared_Identifiers|pre-declared type identifiers]]:


Unsigned integers: <tt>uint8</tt> (or <tt>byte</tt>), <tt>uint16</tt>, <tt>uint32</tt> (or <tt>rune</tt>), <tt>uint64</tt>.
* Unsigned integers: <tt>uint8</tt> (or <tt>byte</tt>), <tt>uint16</tt>, <tt>uint32</tt> (or <tt>rune</tt>), <tt>uint64</tt>.
 
* Signed integers: <tt>int8</tt>, <tt>int16</tt>, <tt>int32</tt>, <tt>int64</tt>.
Signed integers: <tt>int8</tt>, <tt>int16</tt>, <tt>int32</tt>, <tt>int64</tt>.
* Machine-dependent integers: <tt>uint</tt>, <tt>int</tt> and <tt>uintptr</tt>.
 
Machine-dependent integers: <tt>uint</tt>, <tt>int</tt> and <tt>uintptr</tt>.


<tt>int</tt> should be the default.
<tt>int</tt> should be the default.


=Integer Literals=
=Integer Literals=

Revision as of 18:13, 22 March 2016

Internal

Overview

Integers are designated by the following pre-declared type identifiers:

  • Unsigned integers: uint8 (or byte), uint16, uint32 (or rune), uint64.
  • Signed integers: int8, int16, int32, int64.
  • Machine-dependent integers: uint, int and uintptr.

int should be the default.

Integer Literals