[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Bitwise not operator.



Roger Hill writes:

>I've done some further tests and the following fragment :-
>
>  $a = hex("FFFFFF00");
>  printf "%X %X\n", $a, ~$a;
>
>  $a = 0xFFFFFF00;
>  printf "%X %X\n", $a, ~$a;
>
>returns
>
>  FFFFFF00 FF          ! Correct
>  FFFFFF00 7FFFFFFF    ! Wrong
>
>So I at least have a workaround with hex() to use,
>even if 0xffffff00 does not work as a C programmer
>might expect it to!
>
>(This is macPerl 5.0.7 now)
>
>End of story.

Interestingly using MacPerl 68K both hex("FFFFFF00") and 0xFFFFFF00 give
the correct answer, so it would seem a bug has crept in in the later
version?

Alan Fry