Skip Menu |
Report information
Id: 132864
Status: new
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: jim.avera [at]

Severity: (no value)
Tag: (no value)
Platform: (no value)
Patch Status: (no value)
VM: (no value)

Subject: Make P6 "int" always match C "int" (or provide an alternative)
From: Jim Avera <jim.avera [...]>
Date: Tue, 13 Feb 2018 11:51:29 -0800
To: rakudobug [...]
Hello, Please see for motivation. In brief: The P6 "native" type int is currently not guaranteed to be the same as an "int" in C, which prevents portably using "int" with NativeCall to interface to C code which has "int" arguments. My suggestion: Officially guarantee that P6 "int" will always match a C "int" on the current platform.  Document that portable code should assume a range of -32768..32767 (16 bits), which is the minimum required by C99. This change will allow "int" to be used portably with NativeCall and DWIM on all platforms. Alternatively: Define another "native" type which _is_ guaranteed to be the same as a C "int", and document it's use with NativeCall. If this solution is taken, then make the compiler emit an error if "int" is used in a CStruct or similar constructs, to prevent people from thinking they are writing portable code. ------------- Relatedly, there should be a native "unsigned" which is guaranteed to match a C "unsigned", for use with NativeCall. -Jim

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at