diff options
author | David Mitchell <davem@iabyn.com> | 2010-04-15 10:20:50 +0100 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2010-04-15 10:32:59 +0100 |
commit | f2338a2e8347fc967ab6b9af21d948258b88e341 (patch) | |
tree | ac9b735cf41f4c61d74904471fdbdd84297fdeeb /pp.c | |
parent | db63319f533e643ef6aac622fcae9a2f7ceabb0d (diff) | |
download | perl-f2338a2e8347fc967ab6b9af21d948258b88e341.tar.gz |
use cBOOL for bool casts
bool b = (bool)some_int
doesn't necessarily do what you think. In some builds, bool is defined as
char, and that cast's behaviour is thus undefined. So this line in mg.c:
const bool was_temp = (bool)SvTEMP(sv);
was actually setting was_temp to false even when the SVs_TEMP flag was set.
Fix this by replacing all the (bool) casts with a new cBOOL() cast macro
that (hopefully) does the right thing.
Diffstat (limited to 'pp.c')
-rw-r--r-- | pp.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -1030,7 +1030,7 @@ PP(pp_pow) on same algorithm as above */ register UV result = 1; register UV base = baseuv; - const bool odd_power = (bool)(power & 1); + const bool odd_power = cBOOL(power & 1); if (odd_power) { result *= base; } |