int/long unification hides bugs
Steve Holden
steve at holdenweb.com
Wed Oct 27 08:02:47 EDT 2004
kartik wrote:
> Steve Holden <steve at holdenweb.com> wrote in message news:<Z6kfd.18413$SW3.4432 at fed1read01>...
>
>>kartik wrote:
>>
>>
>>>Peter Hansen <peter at engcorp.com> wrote in message news:<_aadnTCr7PWKYeHcRVn-rg at powergate.ca>...
>>>
>>>
>>>
>>>>Do you feel strongly enough about the quality of your code to write
>>>>automated tests for it? Or are you just hoping that one tiny class
>>>>of potential bugs will be caught for you by this feature of the
>>>>language?
>>>
>>>
>>>1)catching overflow bugs in the language itself frees u from writing
>>>overflow tests.
>>
>>That seems to me to be a bit like saying you don't need to do any
>>engineering calculations for your bridge because you'll find out if it's
>>not strong enough when it falls down.
>
>
> i was inaccurate. what i meant was that overflow errors provide a
> certain amount of sanity checking in the absence of explicit testing -
> & do u check every assignment for bounds?
>
If limiting the range of integers is critical to a program's function
then I will happily make range assertions. Frankly I can't remember when
the last overflow error came up in my code.
>
>>>2)no test (or test suite) can catch all errors, so language support 4
>>>error detection is welcome.
>>
>>Yes, but you appear to feel that an arbitrary limit on the size of
>>integers will be helpful [...] Relying on hardware overflows as error
>>detection is pretty poor, really.
>
>
> i'm not relying on overflow errors to ensure correctness. it's only a
> mechanism that sometimes catches bugs - & that's valuable.
>
But your original assertion was that the switch to unbounded integers
should be reversed because of this. Personally I think it's far more
valuable to be able to ignore the arbitrary limitations of supporting
hardware.
>
>>>3)overflow detection helps when u dont have automated tests 4 a
>>>particular part of your program.
>>>
>>
>> But writing such tests would help much more.
>
>
> agreed, but do u test your code so thoroughly that u can guarantee
> your code is bug-free. till then, overflow errors help.
>
No they don't.
regards
Steve
--
http://www.holdenweb.com
http://pydish.holdenweb.com
Holden Web LLC +1 800 494 3119
More information about the Python-list
mailing list