In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/b59008ae8ac2856ff5d5730f7019b3e80ae29913?hp=87bac28f3c77a10cf58be33f785c2152ce564ded>
- Log ----------------------------------------------------------------- commit b59008ae8ac2856ff5d5730f7019b3e80ae29913 Author: Aaron Crane <a...@cpan.org> Date: Mon Jan 2 15:12:45 2017 +0000 perlhacktips: add some notes on TRUE and FALSE ----------------------------------------------------------------------- Summary of changes: pod/perlhacktips.pod | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pod/perlhacktips.pod b/pod/perlhacktips.pod index 8b3392d361..e12e81c784 100644 --- a/pod/perlhacktips.pod +++ b/pod/perlhacktips.pod @@ -1627,8 +1627,10 @@ bugs in the past. =head2 When is a bool not a bool? On pre-C99 compilers, C<bool> is defined as equivalent to C<char>. -Consequently assignment of any larger type to a C<bool> is unsafe and may -be truncated. The C<cBOOL> macro exists to cast it correctly. +Consequently assignment of any larger type to a C<bool> is unsafe and may be +truncated. The C<cBOOL> macro exists to cast it correctly; you may also find +that using it is shorter and clearer than writing out the equivalent +conditional expression longhand. On those platforms and compilers where C<bool> really is a boolean (C++, C99), it is easy to forget the cast. You can force C<bool> to be a C<char> @@ -1640,6 +1642,10 @@ run C<Configure> with something like or your compiler's equivalent to make it easier to spot any unsafe truncations that show up. +The C<TRUE> and C<FALSE> macros are available for situations where using them +would clarify intent. (But they always just mean the same as the integers 1 and +0 regardless, so using them isn't compulsory.) + =head2 The .i Targets You can expand the macros in a F<foo.c> file by saying -- Perl5 Master Repository