[Python-Dev] Re: [Python-checkins] CVS: python/dist/src/Modules pypcre.c,2.18,2.19
Thu, 6 Jul 2000 15:59:40 -0700
On Thu, Jul 06, 2000 at 08:09:24PM +0200, Thomas Wouters wrote:
> On Thu, Jul 06, 2000 at 02:27:32PM +0200, Thomas Wouters wrote:
> > PyObject_INIT((PyObject *)b, &PyBuffer_Type);
> > The 'value computed' is useless. The value computed is computed by the ','
> > operator, but the only things in there are sideffect operators. The last
> > operation in the string of ',''s is either a void-returning function or an
> > assignment, so I'd classify this one as a cosmetic bug in gcc ;) adding a
> > '(void)' cast to the PyObject_INIT() macro or the calls to it would fix the
> > warning.
> Er, ignore that. The value computed isn't useless, it's just the first
> argument. I overlooked that, sorry :P The return value is used in a couple
> of places. That leaves only one option to squench this warning, a (void)
> cast at the one spot that causes a warning. Or is there a better way ?
I would say: make PyObject_INIT() a void "function". Since it is just
returning the first argument, then the code can just use that explicitly.
Having a return value seems to indicate that what you pass and what comes
back might actually change. Eek! Not true.
If you don't want to make it a void function, then you'll need to add (void)
casts to a few places.
Greg Stein, http://www.lyra.org/