Re: Avoid using PL_na with newSVpv

[email protected] (Torsten Schoenfeld)
Newsgroups perl.xs
Message-ID <[email protected]>
On 25.09.2013 20:56, Jan Dubois wrote:
> On Wed, Sep 25, 2013 at 11:50 AM, Torsten Schoenfeld
> <[email protected]> wrote:
>> 
>> newSVpv (string, PL_na) // do not do this
> 
> Is this recomended anywhere?

Probably not.  But <http://grep.cpan.me/?q=newSVpv.*PL_na> does show
quite a few hits, only roughly half of which are mine.  Since the bugs
this causes are hard to diagnose, I thought a public service
announcement is appropriate.

> Since this will always write the length of the string to PL_na, I
> can't think of any reason why you would assume that PL_na would
> always be zero.

I think I simply assumed that "na" stood for "not available".  So I took
PL_na as a readability-improving alias for zero.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.