develooper Front page | perl.perl5.porters | Postings from December 2012

Re: SvUPGRADE and void

Thread Previous | Thread Next
Nicholas Clark
December 14, 2012 13:22
Re: SvUPGRADE and void
Message ID:
On Thu, Dec 13, 2012 at 01:14:28PM +0000, Dave Mitchell wrote:

> The first is to stick a (void) in front of every bare SvUPGRADE() in the
> the perl distribution (including dist/ and, via, cpan/).
> This seems like quite a bit of effort and is a retrograde step.

And, arguably, on every distribution on CPAN that also generates a warning?

> The second is to bite the bullet and change SvUPGRADE from an expression
> into a statement; i.e.
> #define SvUPGRADE(sv, mt) (SvTYPE(sv) >= (mt) || (sv_upgrade(sv, mt), 1))
> becomes
> #define SvUPGRADE(sv, mt) if (sv->type >= (mt)) { sv_upgrade(sv, mt); }
> A search for 'if.*SvUPGRADE' on indicates that about 15
> distributions would fail to compile and need fixing.
> I'm open to other suggestions.

I think we should bit the bullet and go for it. For anything that needs
changing, it's a build-time error from the C compiler? (with an easy fix)
That's not going to break anything in production.*

And 15 CPAN distributions isn't hard to offer patches for. 

Nicholas Clark

* And if it does, that's going to have to be a pretty special system which is
  going to be oh so fragile I'm surprised it even worked to start with.

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About