int/long unification hides bugs

kartik vaddadi kartick_vaddadi at yahoo.com
Tue Oct 26 23:14:49 EDT 2004


--- Josiah Carlson <jcarlson at uci.edu> wrote:

> 
> kartick_vaddadi at yahoo.com (kartik) wrote:
> 
> > integers are used in different ways from strings.
> i may expect file
> > paths to be around 100 characters, and if i get a
> 500-character path,
> > i have no problem just because of the length. but
> if a person's age is
> > 500 where i expect it to be less than 100, then
> **definitely**
> > something's wrong.
> 
> So *you* need to do bounds checking.

do you check every assignment for bounds? can you?
overflow errors catch bugs when you dont do the
checks. 


> > as i look at my code, i rarely have an issue with
> string sizes, but if
> > an integer variable gets very large (say > 2**31
> or 2**63), it
> > generally reflects a bug in my code.
> 
> And you should check that, and not rely on a
> misfeature and a mistake. 

why do u want me to check something that the language
can do? for precisely this reason, i consider this not
to be a misfeature or a mistake.

> I don't rely on overflow errors. [...]
> I prefer to check my variables when I rely on them.

i never talked about *relying* on overflow errors to
ensure the correctness of code. it's only a mechanism
that catches bugs in some cases - & that's valuable.

-kartik


		
__________________________________
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail 



More information about the Python-list mailing list