develooper Front page | perl.perl5.porters | Postings from June 2012

RE: Time for a 64-bit perl API?

Thread Previous | Thread Next
From:
Jan Dubois
Date:
June 19, 2012 13:26
Subject:
RE: Time for a 64-bit perl API?
Message ID:
09b901cd4e59$c5c7e480$5157ad80$@activestate.com
On Tue, 19 Jun 2012, bulk 88 wrote:
> ----------------------------------------
> On Mon, 18 Jun 2012, rev.chip@gmail.com wrote:
> >
> > On 6/18/2012 9:46 AM, bulk 88 wrote:
> > > A problem I've run into in the past is ((__int64)-1) == ((int)-1) is false.
> >
> > Well, that's not true. So I think you do not understand the situation.
> >
> >
> _________________________________________
> #include "EXTERN.h"
> #include "perl.h"
> #include "XSUB.h"
> 
> #include "ppport.h"
> 
> #define ERRORFLAG (-1)
> 
> void my_cmp(pTHX_ size_t num){
>     size_t num2 = ERRORFLAG;
>     if(num != num2)
>        croak("not equal");
> }
> 
> 
> MODULE = Local::XS        PACKAGE = Local::XS
> 
> void
> neg1()
> PREINIT:
>     unsigned int num;

You are using (unsigned int) here, which is not the same as (int).

> PPCODE:
>     num = ERRORFLAG;
>     my_cmp(aTHX_ num);
> ________________________________________
> #!/usr/bin/perl -w
> use strict;
> use Local::XS;
> Local::XS::neg1();
> ________________________________________
> not equal at n1.pl line 4.

Does it also print "not equal" when you remove the "unsigned"?

Cheers,
-Jan



Thread Previous | 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