aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorMikkelFJ <mikkelfj@gmail.com>2017-11-17 17:57:01 +0100
committerWouter van Oortmerssen <aardappel@gmail.com>2017-11-17 08:57:01 -0800
commit0cf04ad9d590fcbaaf6f64ddc9f6fc3c03c4f2ab (patch)
tree6876f9424f92f60550e5fd2b3ff37d3d9ef430ef /docs
parentfe483fa380299f32a2cb8e990ec8d9dff34dd977 (diff)
downloadflatbuffers-0cf04ad9d590fcbaaf6f64ddc9f6fc3c03c4f2ab.tar.gz
Document type aliases (#4499)
Diffstat (limited to 'docs')
-rw-r--r--docs/source/Schemas.md14
-rw-r--r--docs/source/Tutorial.md9
2 files changed, 18 insertions, 5 deletions
diff --git a/docs/source/Schemas.md b/docs/source/Schemas.md
index db51ff95..a05b0027 100644
--- a/docs/source/Schemas.md
+++ b/docs/source/Schemas.md
@@ -84,15 +84,19 @@ parent object, and use no virtual table).
### Types
-Built-in scalar types are:
+Built-in scalar types are
-- 8 bit: `byte`, `ubyte`, `bool`
+- 8 bit: `byte` (`int8`), `ubyte` (`uint8`), `bool`
-- 16 bit: `short`, `ushort`
+- 16 bit: `short` (`int16`), `ushort` (`uint16`)
-- 32 bit: `int`, `uint`, `float`
+- 32 bit: `int` (`int32`), `uint` (`uint32`), `float` (`float32`)
-- 64 bit: `long`, `ulong`, `double`
+- 64 bit: `long` (`int64`), `ulong` (`uint64`), `double` (`float64`)
+
+The type names in parentheses are alias names such that for example
+`uint8` can be used in place of `ubyte`, and `int32` can be used in
+place of `int` without affecting code generation.
Built-in non-scalar types:
diff --git a/docs/source/Tutorial.md b/docs/source/Tutorial.md
index 7def2188..daa8ee1d 100644
--- a/docs/source/Tutorial.md
+++ b/docs/source/Tutorial.md
@@ -216,6 +216,15 @@ The last part of the `schema` is the `root_type`. The root type declares what
will be the root table for the serialized data. In our case, the root type is
our `Monster` table.
+The scalar types can also use alias type names such as `int16` instead
+of `short` and `float32` instead of `float`. Thus we could also write
+the `Weapon` table as:
+
+ table Weapon {
+ name:string;
+ damage:int16;
+ }
+
#### More Information About Schemas
You can find a complete guide to writing `schema` files in the