mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-16 09:17:35 +02:00
Divided the data types section
This commit is contained in:
parent
ff1f279b58
commit
aefb3a644d
1 changed files with 4 additions and 0 deletions
|
@ -95,10 +95,14 @@ Here is a snippet demonstrating how C functions may be written using Baker's app
|
||||||
|
|
||||||
## Data Types
|
## Data Types
|
||||||
|
|
||||||
|
### Objects
|
||||||
|
|
||||||
Most Scheme data types are represented as allocated "objects" that contain a tag to identify the object type. For example:
|
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;
|
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):
|
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.
|
> 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.
|
||||||
|
|
Loading…
Add table
Reference in a new issue