Reading http://perldoc.perl.org/perlxs.html#The-NO_INIT-Keyword again, I see I have misread

When I read that link it seems to me that the current PDL code is totally misusing the NO_INIT keyword.
Looks to me that the variable 'pos' is simply a variable that has a value assigned to it - which, one suspects, is (by itself) insufficient to make it an "output" variable at all.

Also, it seems to me that any initializations using NO_INIT need to go after CODE

No, it needs to go *before* CODE. (Perhaps that's what you meant.) With both 2.2210 and 3.03, when I put PDL_Long * pos = NO_INIT; in the CODE section I get an error such as:
Core.xs:673: error: `NO_INIT' undeclared (first use in this function)
Cheers,
Rob

Update: This has now reached the point where I'm thinking I should probably present the function in its entirety. So here it is as it currently appears in Core.xs (which is autogenerated from Core.xs.PL):
SV * at_c(x,position) pdl* x PDL_Long * pos = NO_INIT CODE: int npos, ipos; double result; pdl_make_physvaffine( x ); pos = pdl_packdims( ST(1), &npos); if (pos == NULL || npos < x->ndims) croak("Invalid position"); /* allow additional trailing indices * which must be all zero, i.e. a * [3,1,5] piddle is treated as an [3,1,5,1,1,1,....] * infinite dim piddle */ for (ipos=x->ndims; ipos<npos; ipos++) if (pos[ipos] != 0) croak("Invalid position"); result=pdl_at(PDL_REPRP(x), x->datatype, pos, x->dims, (PDL_VAFFOK(x) ? x->vafftrans->incs : x->dimincs), PDL_REPROFF +S(x), x->ndims); SET_RETVAL_NV(x) ; OUTPUT: RETVAL
To reiterate - that will work fine as is with 2.2210, but only works with 3.03 if there is a typemap entry for 'PDL_Long *'. (With 3.03 it doesn't seem to matter what that typemap entry specifies - as long as there is one.)
If I don't amend the typemap, then to make that Core.xs work with both 2.2210 and 3.03 I have to remove the PDL_Long * pos = NO_INIT and begin the CODE section with a PDL_Long * pos; declaration.

In reply to Re^6: ExtUtils::ParseXS has changed by syphilis
in thread ExtUtils::ParseXS has changed by syphilis

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.