A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2000-August/008255.html below:

[Python-Dev] can this overflow (list insertion)?

[Python-Dev] can this overflow (list insertion)? [Python-Dev] can this overflow (list insertion)?Trent Mick trentm@ActiveState.com
Sat, 12 Aug 2000 15:33:12 -0700
On Sun, Aug 13, 2000 at 12:24:39AM +0200, Vladimir Marangozov wrote:
> +0.
> 
> It could overflow but if it does, this is a bad sign about using a list
> for such huge amount of data.

Point taken.

> 
> And this is the second time in a week that I see an attempt to introduce
> a bogus counter due to post-increments embedded in an if statement!
>

If I read you correctly then I think that you are mistaking my intention. Do
you mean that I am doing the comparison *before* the increment takes place
here:

> > !       if (self->ob_size++ == INT_MAX) {
> > !               PyErr_SetString(PyExc_OverflowError,
> > !                       "cannot add more objects to list");
> > !               return -1;
> > !       }

That is my intention. You can increment up to INT_MAX but not over.....

... heh heh actually my code *is* wrong. But for a slightly different reason.
I trash the value of self->ob_size on overflow. You are right, I made a
mistake trying to be cute with autoincrement in an 'if' statement. I should
do the check and *then* increment if okay.

Thanks,
Trent

-- 
Trent Mick
TrentM@ActiveState.com



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