Skip to content

Commit

Permalink
First attempt at documenting nativetypes
Browse files Browse the repository at this point in the history
I have moved the table to this page and split it in two, eliminating
nonspec types. It will clarify what you can use in native call (those
declared with nativesize) and which ones you can't. Refs #1512.
  • Loading branch information
JJ committed May 30, 2018
1 parent bbfb2ec commit 3067d8c
Showing 1 changed file with 28 additions and 15 deletions.
43 changes: 28 additions & 15 deletions doc/Language/nativetypes.pod6
Expand Up @@ -4,21 +4,34 @@
=SUBTITLE Using the types the compiler and hardware make available to you.
=head1 Integer types and their behavior
TBD
=head1 Strings and arrays
TBD
=head1 C<structs>
TBD
=head1 Native representation
TBD
Some simple types in Perl 6 have a I<native> representation, indicating that they will use the C language representation provided by the compiler, operating system and machine. These are the four native types available:
X<|int>X<|uint>X<|num>X<|str>
=begin table
int Equivalent to Int
uint Equivalent to Int with the unsigned trait
num Equivalent to Num
str Equivalent to Str
=end table
However, these types do not necessarily have the size that is required by the
NativeCall interface (e.g., Perl 6's C<int> can be 8 bytes but C's C<int> is
only 4 bytes). Instead, the types below will have to be used instead of the
types C<int> or C<num> listed above.
X<|int8>X<|int16>X<|int32>X<|int64>X<|uint8>X<|uint16>X<|uint32>X<|uint64>X<|num32>X<|num64>
=begin table
int8 (int8_t in C, also used for char)
int16 (int16_t in C, also used for short)
int32 (int32_t in C, also used for int)
int64 (int64_t in C)
uint8 (uint8_t in C, also used for unsigned char)
uint16 (uint16_t in C, also used for unsigned short)
uint32 (uint32_t in C, also used for unsigned int)
uint64 (uint64_t in C)
num32 (float in C)
num64 (double in C)
=end table
=end pod
Expand Down

0 comments on commit 3067d8c

Please sign in to comment.