develooper Front page | perl.perl6.users | Postings from December 2019

implicit type change

Thread Next
From:
Marcel Timmerman
Date:
December 8, 2019 19:02
Subject:
implicit type change
Message ID:
983e0567-b153-6579-e35b-9149badc8ba6@gmail.com
Hello,

I have a nasty problem using native call interface. I get an array of 
bytes from a call representing a pixel buffer. I am storing it in a 
CArray[byte]. Golfing it down it comes to the following (REPL)


 > use NativeCall
 > my CArray[byte] $ba .= new( 255, 254, 3, 4);
NativeCall::Types::CArray[byte].new
 > $ba[0].WHAT
(Int)
 > $ba[0..*-1]
(-1 -2 3 4)


This means (for me) that there is an implicit type conversion from 
unsigned to signed integer and it is not possible to use positive 
numbers only, afterwards.

Regards,
Marcel

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About