×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
Hi Bryce,
On 5/18/2010 7:55 AM, Bryce Martin wrote:
Why wouldn't you want the compiler to catch as many things as possible?
I'm not sure you understand the ramifications of what you're asking for.
You, seriously, want a warning every single time a field _can_ overflow?
I agree that, when it's obvious that the field _will_ overflow, it'd be
nice if the compiler warned you. For example something like this:
D x s 3p 0
x = 99999999;
There's no way that 99999999 can fit in a 3,0 field. It'll never
happen, so this code will always blow up. It might be nice if the
compiler warned you of this -- but on the other hand, shouldn't this be
obvious to the programmer?
But I sure don't want a warning any time a field _can_ overflow.
There'd be so many warnings I'd go crazy. For example, this:
count = count + 1;
It doesn't matter what 'count' is defined as, this statement has the
chance of overflowing since if count is already at it's maximum value,
this would overflow. Do you really want the compiler to send you a
warning every single time you accumulate anything?
total = total + itemExtended;
-or-
totWeight = totWeight + (boxQty * wgtPerBox);
This would always generate an overflow warning! This type of logic is
completely ubiquitous in business programming. You'd be getting
overflows everywhere.
Seems like a gross overreaction to the original problem. (Which frankly,
was purely a matter of inexperience on the part of the O.P.)
As an Amazon Associate we earn from qualifying purchases.