This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Change LIKELY() and UNLIKELY() to cast their first argument to a bool.
authorNicholas Clark <nick@ccl4.org>
Wed, 6 Mar 2013 15:27:08 +0000 (16:27 +0100)
committerNicholas Clark <nick@ccl4.org>
Mon, 20 May 2013 17:13:50 +0000 (19:13 +0200)
commit6d5abc62848da0e110869e2b13c68bf498ff3a90
treec38df027bb7ae7818d233d1e3311bf946d8b4726
parentb2bf251fd850e281217ec1d042c1839e3ed4a09c
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.
perl.h