I have the following cargo-culted code:

STATIC void croak_for_this_reason(pTHX_ ...) { dVAR; ... Perl_croak(aTHX_ ...); } croak_for_this_reason(aTHX_ ...);

Is Perl_croak(aTHX_ ...) the same as croak(...)?

Is dVAR; needed by aTHX?

I'm using a threaded build of Perl. I thought the whole "THX mess" was to support that, yet aTHX appears to be empty (no error if I omit it). What is THX for?


Update: I think I need this:

STATIC void croak_for_this_reason(pTHX_ ...) { ... Perl_croak(aTHX_ ...); } croak_for_this_reason(aTHX_ ...);

(but not dVAR;), and it which can be written as:

STATIC void croak_for_this_reason(pTHX_ ...) { #define croak_for_this_reason(...) croak_for_this_reason(aTHX_ ...) ... croak(...); } croak_for_this_reason(...);

In reply to XS: THX questions by ikegami

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.