Skip to content

Commit

Permalink
Simplify cBOOL defn
Browse files Browse the repository at this point in the history
This existed because there wasn't a compiler bool necessarily, and
made complicated to workaround a bug in an AIX compiler as of 2010-ish.
Now that C99 is required, there always is a bool type; we don't know if
the bug existed in a C99 mode for the broken compiler, and sufficient
time has passed that it should have been fixed nonetheless.

This was tested on

IBM XL C/C++ for AIX, V12.1 (5765-J02, 5725-C72)
Version: 12.01.0000.0012

which dates to about 2012.
  • Loading branch information
khwilliamson committed Feb 6, 2022
1 parent 090ce0f commit 9fa5fd9
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions handy.h
Expand Up @@ -114,15 +114,15 @@ already-built-in ones return pointers to what their names indicate.
=for apidoc_section $casting
=for apidoc Am|bool|cBOOL|bool expr
Cast-to-bool. A simple S<C<(bool) I<expr>>> cast may not do the right thing:
if C<bool> is defined as C<char>, for example, then the cast from C<int> is
implementation-defined.
C<(bool)!!(cbool)> in a ternary triggers a bug in xlc on AIX
Cast-to-bool. When Perl was able to be compiled on pre-C99 compilers, a
C<(bool)> cast didn't necessarily do the right thing, so this macro was
created (and made somewhat complicated to work around bugs in old
compilers). Now, many years later, and C99 is used, this is no longer
required, but is kept for backwards compatibility.
=cut
*/
#define cBOOL(cbool) ((cbool) ? (bool)1 : (bool)0)
#define cBOOL(cbool) ((bool) (cbool))

/* Try to figure out __func__ or __FUNCTION__ equivalent, if any.
* XXX Should really be a Configure probe, with HAS__FUNCTION__
Expand Down

0 comments on commit 9fa5fd9

Please sign in to comment.