XS Constants peculiarity

Chris Jack chris_jack at msn.com
Thu Oct 28 12:32:35 BST 2010


Dirk Koopman wrote:
> Why would RK + LOCK give a different result to RK | LOCK?
 
Don't know. I don't have your module but if I create FF.pm as:

use constant LOCK => 0x100000;
use constant RK => 0x4;
1;

perl -e 'use FF; printf "0x%x\n", $_ for (LOCK, RK, RK | LOCK, RK + LOCK)'

And use perl 5.8.6, it gives 
0x100000
0x4
0x100004
0x100004

Would suggest your try:
perl -e 'use FF; printf "0x%x\n", $_ for (RK + LOCK, LOCK + RK, (RK) + (LOCK))'

and see what happens - or use intermediate variables: e.g.
$RK_var = RK;
$LOCK_var = LOCK;
$RK_var + $LOCK_var;

Regards
Chris
 		 	   		  


More information about the london.pm mailing list