# New Ticket Created by David Warring
# Please include the string: [perl #127908]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org/Ticket/Display.html?id=127908 >
Consider:
$ perl6 -v
This is Rakudo version 2016.03-124-g4b0e5bd built on MoarVM version
2016.03-108-gca1a21a
implementing Perl 6.c.
$ $ perl6 -e'use NativeCall; our sub abs(int $c) returns int is native { * }'
Potential difficulties:
In 'abs' routine declaration - Not an accepted NativeCall type for
parameter [1] $c : int
--> For Numerical type, use the appropriate int32/int64/num64...
at -e:1
------> abs(int $c) returns int is native { * }⏏<EOL>
The returning type of 'abs' --> int is erroneous. You should not return a
non NativeCall supported type (like Int inplace of int32), truncating errors
can appear with different architectures
at -e:1
------> abs(int $c) returns int is native { * }⏏<EOL>
But 'int' is a standard C type that is in widespread use. For example the
definition of abs(), from stdlib.h is:
/* Return the absolute value of X. */
extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;