On Mon, 17 Jun 2019 12:10:42 GMT, pali@cpan.org wrote: > From 9dda3b96e0639d0504fea1ab1f9fee4330d7878f Mon Sep 17 00:00:00 2001 > From: Pali <pali@cpan.org> > Date: Mon, 17 Jun 2019 14:09:08 +0200 > Subject: [PATCH] Document SvTRUEx() macro > > --- > sv.h | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/sv.h b/sv.h > index 637cd14dc0..15adf03449 100644 > --- a/sv.h > +++ b/sv.h > @@ -1601,10 +1601,21 @@ false. See C<L</SvOK>> for a > defined/undefined test. Handles 'get' magic > unless the scalar is already C<SvPOK>, C<SvIOK> or C<SvNOK> (the > public, not the > private flags). > > +See C<L</SvTRUEx>> for a version which guarantees to evaluate C<sv> > only once. > + > =for apidoc Am|bool|SvTRUE_nomg|SV* sv > Returns a boolean indicating whether Perl would evaluate the SV as > true or > false. See C<L</SvOK>> for a defined/undefined test. Does not > handle 'get' magic. > > +=for apidoc Am|bool|SvTRUEx|SV* sv > +Returns a boolean indicating whether Perl would evaluate the SV as > true or > +false. See C<L</SvOK>> for a defined/undefined test. Handles 'get' > magic > +unless the scalar is already C<SvPOK>, C<SvIOK> or C<SvNOK> (the > public, not the > +private flags). > + > +This form guarantees to evaluate C<sv> only once. Only use this if > C<sv> is an > +expression with side effects, otherwise use the more efficient > C<SvTRUE>. > + > =for apidoc Am|char*|SvPVutf8_force|SV* sv|STRLEN len > Like C<SvPV_force>, but converts C<sv> to UTF-8 first if necessary. > Have we agreed that this macro is part of our public API? -- James E Keenan (jkeenan@cpan.org) --- via perlbug: queue: perl5 status: new https://rt.perl.org/Ticket/Display.html?id=134200Thread Previous | Thread Next