Front page | perl.perl5.porters |
Postings from December 2012
Re: SvUPGRADE and void
Thread Previous
|
Thread Next
From:
Dave Mitchell
Date:
December 14, 2012 21:47
Subject:
Re: SvUPGRADE and void
Message ID:
20121214214718.GL1842@iabyn.com
On Fri, Dec 14, 2012 at 03:26:09PM -0500, Peter Martini wrote:
> On Fri, Dec 14, 2012 at 3:06 PM, Nicholas Clark <nick@ccl4.org> wrote:
> > On Fri, Dec 14, 2012 at 02:59:09PM -0500, Peter Martini wrote:
> >> On Fri, Dec 14, 2012 at 12:48 PM, Dave Mitchell <davem@iabyn.com> wrote:
> >> > On Fri, Dec 14, 2012 at 03:22:15PM +0000, Dave Mitchell wrote:
> >
> >> >> Ok, I've bitten the bullet.
> >> >
> >> > ... and broken g++.
> >> >
> >> > Can anyone suggest a definition for SvUPGRADE that works for both of the
> >> > forms
> >> >
> >> > SvUPGRADE(...);
> >> > (void)SvUPGRADE(...);
> >> >
> >> > on gcc, clang and g++, and doesn't generate warnings?
Thanks for the various suggestions, guys. I didn't follow any of them
as-is, but they gave me enough food for thought to come up with
#define SvUPGRADE(sv, mt) \
((void)(SvTYPE(sv) >= (mt) || (sv_upgrade(sv, mt),1)))
which seems to be silent with all of gcc, clang, g++ for both of the
constructs:
SvUPGRADE(..);
(void)SvUPGRADE(..);
but which will no doubt be whined about by some future compiler.
(Its actually the original macro, but with an extra (void) at the front!)
--
The Enterprise is captured by a vastly superior alien intelligence which
does not put them on trial.
-- Things That Never Happen in "Star Trek" #10
Thread Previous
|
Thread Next