On Fri, Mar 20, 2009 at 10:30 PM, Stefan Behnel <[email protected]> wrote:

>
> Prajwal Suhas P wrote:
> > I have restructured and removed the redundant code. Can someone review
> this
> > patch.
>
> I cleaned it up a bit in the way I described in my last e-mail. Now it
> looks ok to me. One problem I noticed is that I get a gcc warning about
> this code:
>
> --------------------------------
>  def f():
>      cdef int i
>       for i in range(g()):
>          print i
>      print i
>
> warning: '__pyx_v_i' may be used uninitialized in this function
> --------------------------------
>
> which is true, because "i" may not have been initialised at the end,
> depending on the return value of g(). Since this is exactly what Python
> will tell you also, I'm fine with leaving it as it is, though:
>
> --------------------------------
> >>> for i in range(0): print i
> ...
> >>> i
> Traceback (most recent call last):
>  File "<stdin>", line 1, in <module>
> NameError: name 'i' is not defined
> --------------------------------
>
> So I fixed the test case also by initialising i.
>
> Is this ok with you?
>
> Stefan
> _______________________________________________
> Cython-dev mailing list
> [email protected]
> http://codespeak.net/mailman/listinfo/cython-dev
>

 Perfect. No issues. I initialized "i" to zero and it worked as expected.

-- 
Regards,
Prajwal S.

"There is little difference in people,but this little difference makes a big
difference.The little difference is attitude,the big difference is whether
its positive or negative. "
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to