This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
use cBOOL for bool casts
authorDavid Mitchell <davem@iabyn.com>
Thu, 15 Apr 2010 09:20:50 +0000 (10:20 +0100)
committerDavid Mitchell <davem@iabyn.com>
Thu, 15 Apr 2010 09:32:59 +0000 (10:32 +0100)
commitf2338a2e8347fc967ab6b9af21d948258b88e341
treeac9b735cf41f4c61d74904471fdbdd84297fdeeb
parentdb63319f533e643ef6aac622fcae9a2f7ceabb0d
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.
av.c
handy.h
mg.c
numeric.c
pp.c
regexec.c
scope.c
sv.c
toke.c