produce redeclaration warning on C<our $foo; { our $foo; ... }>
[p5sagit/p5-mst-13.2.git] / pod / perlguts.pod
index 4081570..a8d820e 100644 (file)
@@ -107,9 +107,10 @@ Also remember that C doesn't allow you to safely say C<foo(SvPV(s, len),
 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(len);
+       ptr = SvPV(s, len);
        foo(ptr, len);
 
 If you want to know if the scalar value is TRUE, you can use:
@@ -1098,10 +1099,15 @@ this:
 
   SAVEDELETE(PL_defstash, savepv(tmpbuf), strlen(tmpbuf));
 
-=item C<SAVEDESTRUCTOR(f,p)>
+=item C<SAVEDESTRUCTOR(DESTRUCTORFUNC_NOCONTEXT_t f, void *p)>
 
 At the end of I<pseudo-block> the function C<f> is called with the
-only argument (of type C<void*>) C<p>.
+only argument C<p>.
+
+=item C<SAVEDESTRUCTOR_X(DESTRUCTORFUNC_t f, void *p)>
+
+At the end of I<pseudo-block> the function C<f> is called with the
+implicit context argument (if any), and C<p>.
 
 =item C<SAVESTACK_POS()>
 
@@ -1506,7 +1512,7 @@ additional complications for conditionals).  These optimizations are
 done in the subroutine peep().  Optimizations performed at this stage
 are subject to the same restrictions as in the pass 2.
 
-=head1 The Perl API
+=head1 The Perl Internal API
 
 WARNING: This information is subject to radical changes prior to
 the Perl 5.6 release.  Use with caution.
@@ -1529,9 +1535,7 @@ data structure under USE_THREADS, and the PERL_OBJECT build has a C++
 class to maintain interpreter state.  In all three cases,
 PERL_IMPLICIT_CONTEXT is also normally defined, and enables the
 support for passing in a "hidden" first argument that represents all three
-data structures.  (The traditional MULTIPLICITY and USE_THREADS builds
-built without PERL_IMPLICIT_CONTEXT may also be supported, but this is
-currently somewhat broken.)
+data structures.
 
 All this obviously requires a way for the Perl internal functions to be
 C++ methods, subroutines taking some kind of structure as the first
@@ -1560,7 +1564,8 @@ function used within the Perl guts:
 
 STATIC becomes "static" in C, and is #define'd to nothing in C++.
 
-A public function (i.e. part of the API) begins like this:
+A public function (i.e. part of the internal API, but not necessarily
+sanctioned for use in extensions) begins like this:
 
   void
   Perl_sv_setsv(pTHX_ SV* dsv, SV* ssv)
@@ -1734,9 +1739,9 @@ call, since it is always passed as an extra argument.  Depending on
 your needs for simplicity or efficiency, you may mix the previous
 two approaches freely.
 
-Never say C<pTHX,> yourself--always use the form of the macro with the
-underscore for functions that take explicit arguments, or the form
-without the argument for functions with no explicit arguments.
+Never add a comma after C<pTHX> yourself--always use the form of the
+macro with the underscore for functions that take explicit arguments,
+or the form without the argument for functions with no explicit arguments.
 
 =head2 Future Plans and PERL_IMPLICIT_SYS
 
@@ -1764,7 +1769,9 @@ more "hosts", with free association between them.
 =head1 API LISTING
 
 This is a listing of functions, macros, flags, and variables that may be
-useful to extension writers or that may be found while reading other
+used by extension writers.  The interfaces of any functions that are not
+listed here are subject to change without notice.  For this reason,
+blindly using functions listed in proto.h is to be avoided when writing
 extensions.
 
 Note that all Perl API global variables must be referenced with the C<PL_>
@@ -2906,15 +2913,17 @@ Test two strings to see if they are different.  Returns true or false.
 
 Test two strings to see if they are equal.  The C<len> parameter indicates
 the number of bytes to compare.  Returns true or false.
+(A wrapper for C<strncmp>).
 
-       int     strnEQ( char *s1, char *s2 )
+       int     strnEQ( const char *s1, const char *s2, size_t len )
 
 =item strnNE
 
 Test two strings to see if they are different.  The C<len> parameter
 indicates the number of bytes to compare.  Returns true or false.
+(A wrapper for C<strncmp>).
 
-       int     strnNE( char *s1, char *s2, int len )
+       int     strnNE( const char *s1, const char *s2, size_t len )
 
 =item sv_2mortal
 
@@ -3648,24 +3657,26 @@ Like C<sv_usepvn>, but also handles 'set' magic.
 
        void    sv_usepvn_mg (SV* sv, char* ptr, STRLEN len)
 
-=item sv_vcatpvfn(sv, pat, patlen, args, svargs, svmax, used_locale)
+=item sv_vcatpvfn
 
 Processes its arguments like C<vsprintf> and appends the formatted output
 to an SV.  Uses an array of SVs if the C style variable argument list is
-missing (NULL).  Indicates if locale information has been used for formatting.
+missing (NULL).  When running with taint checks enabled, indicates via
+C<maybe_tainted> if results are untrustworthy (often due to the use of
+locales).
 
        void    sv_catpvfn (SV* sv, const char* pat, STRLEN patlen,
                            va_list *args, SV **svargs, I32 svmax,
-                           bool *used_locale);
+                           bool *maybe_tainted);
 
-=item sv_vsetpvfn(sv, pat, patlen, args, svargs, svmax, used_locale)
+=item sv_vsetpvfn
 
 Works like C<vcatpvfn> but copies the text into the SV instead of
 appending it.
 
        void    sv_setpvfn (SV* sv, const char* pat, STRLEN patlen,
                            va_list *args, SV **svargs, I32 svmax,
-                           bool *used_locale);
+                           bool *maybe_tainted);
 
 =item SvUV