develooper Front page | perl.perl5.porters | Postings from April 2000

Re: More patching! Less whining!

Nick Ing-Simmons
April 2, 2000 04:42
Re: More patching! Less whining!
Message ID:
Alan Burlison <> writes:
>> That is doubly not true:
>> 1. The use of bare 'na' etc. has been deprecated since 5.005-ish.
>> 2. There is a work round by setting POLLUTE - so compatibility _is_ built in.
>I've worked around this in the past by doing the following:
>#ifndef PL_na
>#define PL_na na
>#ifndef PL_sv_undef
>#define PL_sv_undef sv_undef
>To provide backwards compatibility with old perls.  This works fine in
>5.005_03, but breaks in 5.6.0.  

Yes I can see that might be a problem if they are just variables rather
than #defines - as it the case for non-threaded non-multiplicity 5.6.0

>What is the correct incantation that
>preserves backwards compatibility?

The incantation I have in Tk is:

#include <patchlevel.h>

#if defined(PATCHLEVEL) && (PATCHLEVEL < 5)
#define PL_sv_undef	sv_undef
#define PL_stack_base	stack_base
#define PL_stack_sp	stack_sp

Note that is doubly subtle as PATCHLEVEL itself is now not set by 

And also (because I never want to use perl's na which is just a 
waste of CPU cycles for somthing you don't want):

#ifdef na
#undef na

I forget why the PATCHLEVEL test is in that one.

>Alan Burlison
Nick Ing-Simmons Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About