Skip to content

Commit

Permalink
Adds clarification to void type
Browse files Browse the repository at this point in the history
Follow @zoffixznet comment in rakudo/rakudo#1982.
  • Loading branch information
JJ committed Jun 28, 2018
1 parent 8921b20 commit 89f1b00
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
10 changes: 5 additions & 5 deletions doc/Language/nativecall.pod6
Expand Up @@ -616,14 +616,14 @@ leaks.
=comment TODO
TBD
L<Blob>s and L<Buf>s are Perl 6 way of storing binary data. We can use them for interchange of data with native functions and data structures, although not directly. We will have to use L<C<nativecast>|/routine/nativecast>.
=head1 Function arguments
NativeCall also supports native functions that take functions as arguments. One example
of this is using function pointers as callbacks in an event-driven system. When
binding these functions via NativeCall, one need only provide the equivalent signature
as a constraint on the code parameter:
NativeCall also supports native functions that take functions as arguments. One
example of this is using function pointers as callbacks in an event-driven
system. When binding these functions via NativeCall, one need only provide the
equivalent signature as a constraint on the code parameter:
use NativeCall;
# void SetCallback(int (*callback)(const char *))
Expand Down
7 changes: 4 additions & 3 deletions doc/Language/nativetypes.pod6
Expand Up @@ -99,9 +99,10 @@ valid type, you can use it in expressions:
my void $nothing;
say $nothing.perl; # OUTPUT: «NativeCall::Types::void␤»
In practice, it is an C<Uninstantiable> type that can rarely be used by itself.
However, it is generally found in typed pointers representing the equivalent to
the C<void *> pointer in C.
In practice, it is an C<Uninstantiable> type that can rarely be used by itself,
and in fact it is L<explicitly forbidden in C<return> types|/language/nativecall#Passing_and_Returning_Values>. However, it is
generally found in typed pointers representing the equivalent to the C<void *>
pointer in C.
=begin code :preamble<use NativeCall;>
sub malloc( int32 $size --> Pointer[void] ) is native { * };
Expand Down

0 comments on commit 89f1b00

Please sign in to comment.