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

Re: More patching! Less whining!

From:
Nick Ing-Simmons
Date:
April 2, 2000 04:42
Subject:
Re: More patching! Less whining!
Message ID:
E12bikX-0001CU-00@mserv1c.u-net.net
Alan Burlison <Alan.Burlison@uk.sun.com> 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
>#endif
>
>#ifndef PL_sv_undef
>#define PL_sv_undef sv_undef
>#endif
>
>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:

#ifndef PATCHLEVEL
#include <patchlevel.h>
#endif

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

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

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
#if PATCHLEVEL >= 5
#undef na
#endif
#endif

I forget why the PATCHLEVEL test is in that one.

>
>Alan Burlison
-- 
Nick Ing-Simmons




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About