In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/6d5abc62848da0e110869e2b13c68bf498ff3a90?hp=b2bf251fd850e281217ec1d042c1839e3ed4a09c>
- Log ----------------------------------------------------------------- commit 6d5abc62848da0e110869e2b13c68bf498ff3a90 Author: Nicholas Clark <[email protected]> Date: Wed Mar 6 16:27:08 2013 +0100 Change LIKELY() and UNLIKELY() to cast their first argument to a bool. This avoids problems such as pointers being compared with the literal value 1. Suggested by Zefram. Note that this is technically a change of behaviour, as the macro EXPECT(), which they are both both wrappers for, returns its value, so they will now be returning TRUE or FALSE, rather than the actual value passed to them. However, all uses in the core and on CPAN are only within if() statements, so this should not make any difference in practice. ----------------------------------------------------------------------- Summary of changes: perl.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/perl.h b/perl.h index 89f4c98..dc5e411 100644 --- a/perl.h +++ b/perl.h @@ -3329,8 +3329,8 @@ typedef pthread_key_t perl_key; #else # define EXPECT(expr,val) (expr) #endif -#define LIKELY(cond) EXPECT(cond,1) -#define UNLIKELY(cond) EXPECT(cond,0) +#define LIKELY(cond) EXPECT(cBOOL(cond),TRUE) +#define UNLIKELY(cond) EXPECT(cBOOL(cond),FALSE) #ifdef HAS_BUILTIN_CHOOSE_EXPR /* placeholder */ #endif -- Perl5 Master Repository
