: d function has documentation with its source
: s static function, should have an S_ prefix in
: source file; for macros (m), suffix the usage
-: example with a semicolon
+: example with a semicolon
: n has no implicit interpreter/thread context argument
: p function has a Perl_ prefix
: f function takes printf style format string, varargs
: R Return value must not be ignored.
: P pure function: no effects except the return value;
: return value depends only on parms and/or globals
+: (see also L<perlguts/Internal Functions> for those flags.)
:
: Pointer parameters that must not be passed NULLs should be prefixed with NN.
:
len);>. It might work with your compiler, but it won't work for everyone.
Break this sort of statement up into separate assignments:
- SV *s;
- STRLEN len;
- char * ptr;
- ptr = SvPV(s, len);
- foo(ptr, len);
+ SV *s;
+ STRLEN len;
+ char * ptr;
+ ptr = SvPV(s, len);
+ foo(ptr, len);
If you want to know if the scalar value is TRUE, you can use:
=item A
-This function is a part of the public API.
+This function is a part of the public API. All such functions should also
+have 'd', very few do not.
=item p
-This function has a C<Perl_> prefix; i.e. it is defined as C<Perl_av_fetch>
+This function has a C<Perl_> prefix; i.e. it is defined as
+C<Perl_av_fetch>.
=item d
This function has documentation using the C<apidoc> feature which we'll
-look at in a second.
+look at in a second. Some functions have 'd' but not 'A'; docs are good.
=back
=item s
-This is a static function and is defined as C<S_whatever>, and usually
-called within the sources as C<whatever(...)>.
+This is a static function and is defined as C<STATIC S_whatever>, and
+usually called within the sources as C<whatever(...)>.
=item n
-This does not use C<aTHX_> and C<pTHX> to pass interpreter context. (See
+This does not need a interpreter context, so the definition has no
+C<pTHX>, and it follows that callers don't use C<aTHX>. (See
L<perlguts/Background and PERL_IMPLICIT_CONTEXT>.)
=item r
Binary backward compatibility; this function is a macro but also has
a C<Perl_> implementation (which is exported).
+=item others
+
+See the comments at the top of C<embed.fnc> for others.
+
=back
If you edit F<embed.pl> or F<embed.fnc>, you will need to run
interpreters for other languages in the Perl core, but it also allows
optimizations through the creation of "macro-ops" (ops which perform the
functions of multiple ops which are usually executed together, such as
-C<gvsv, gvsv, add>.)
+C<gvsv, gvsv, add>.)
This feature is implemented as a new op type, C<OP_CUSTOM>. The Perl
core does not "know" anything special about this op type, and so it will