Hello, I'm wondering what compilers that you are aware of would throw such a warning after something related to the following code. Borland is complaining rather loudly (in the order of 200+ warnings, although some are for other things I havn't looked into) because of the use of this idiom. I'm not sugguesting it must be changed, but now that I understand what's going on, it seems *correct* that this throws a warning. 'retval' is assigned a value, in this case, NULL, and there is no path of execution where it's even remotely possible for that NULL to be used... so its a wasted operation. Why? Because retval is never actually used until it is assigned to later on. --- snip --- (from arraymodule, btw :)) static PyObject * array_buffer_info(arrayobject *self, PyObject *args) { PyObject* retval = NULL; if (!PyArg_ParseTuple(args, ":buffer_info")) return NULL; retval = PyTuple_New(2); if (!retval) return NULL; PyTuple_SET_ITEM(retval, 0, PyLong_FromVoidPtr(self->ob_item)); PyTuple_SET_ITEM(retval, 1, PyInt_FromLong((long)(self->ob_size))); return retval; } --- snip --- --Stephen (replace 'nospam' with 'seraph' to respond in email) "Fredrik Lundh" <fredrik at pythonware.com> wrote in message news:nlXE6.9158$4N4.2042457 at newsc.telia.net... > Stephen Hansen wrote: > > It explains the infinate spam of warning messages I get, though, > > since quite a few pointers are initialized to NULL and that NULL is > > never read in. This is not something I think the Gods'o'Python > > would care to have fixed, though. Dispite a 'no warnings' policy :) > > other compilers complain about possible "use before assignment" if > you don't initialize them to NULL... > > Cheers /F > >
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4