Divided the data types section

This commit is contained in:
Justin Ethier 2015-08-03 21:50:11 -04:00
parent ff1f279b58
commit aefb3a644d

View file

@ -95,10 +95,14 @@ Here is a snippet demonstrating how C functions may be written using Baker's app
## Data Types
### Objects
Most Scheme data types are represented as allocated "objects" that contain a tag to identify the object type. For example:
typedef struct {tag_type tag; double value;} double_type;
### Value Types
On the other hand, some data types can be represented using 30 bits or less and can be stored as value types using a technique from Lisp in Small Pieces. On many machines, addresses are multiples of four, leaving the two least significant bits free. [A brief explanation](http://stackoverflow.com/q/9272526/101258):
> The reason why most pointers are aligned to at least 4 bytes is that most pointers are pointers to objects or basic types that themselves are aligned to at least 4 bytes. Things that have 4 byte alignment include (for most systems): int, float, bool (yes, really), any pointer type, and any basic type their size or larger.