I keep looking at this piece of overload.pm documentation:
* *Assignments*
+= -= *= /= %= **= <<= >>= x= .=
&= |= ^= &.= |.= ^.=
[snip]
The subroutine for the assignment variant of an operator is
required only to return the result of the operation.
That seems to me to be asserting that these operations (unlike '++' and '--') do require a value to be returned.
And it also looks to me that overload.pm is somehow enforcing that policy.
This following rewrite of the simplified overload_add_eq C and XS functions works fine:
void overload_add_eq(pTHX_ SV * a, SV * b, SV * third) {
dXSARGS;
PERL_UNUSED_ARG(third);
mpz_add_ui(*(INT2PTR(mpz_t *, SvIVX(SvRV(a)))), *(INT2PTR(mpz_t *
+, SvIVX(SvRV(a)))), SvUV(b));
XSRETURN(1);
}
and
void
overload_add_eq (a, b, third)
SV * a
SV * b
SV * third
CODE:
overload_add_eq (aTHX_ a, b, third);
XSRETURN(1);
But I wonder if that achieves anything significant over the implementation that has been working fine for the last umpteen years.
Anyway, I don't want to get too bogged down in this - though it's certainly interesting enough to encourage a bit more investigation.
Cheers,
Rob
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.