event-handling approach to errors
John Chambers
jc at mit-athena.UUCP
Wed Mar 6 01:21:21 AEST 1985
> ... How do
> you provide a correction action for something like a subscript violation?
Hey, MasterCard knows how to handle this. On several occasions, I've
overflowed (overflown?) my credit limit, and they responded promptly
by upping the limit! It takes care of the problem quite nicely.
Seriously, in a language that allows dynamic allocation of space (as do
C, APL, and many other languages), it is not unreasonable to consider
such a solution. I've had several applications where it was a real
pain to initially allocate things to their largest possible size. If
an array will usually only hold 2 or 3 items, but may grow to 50000 in
some cases, you don't want to allocate 50000 in all cases. If you have
several such arrays, what do you do? It would be really nice if you
could intercept the out-of-bounds reference, determine that it was for
one of the select list of "growable" arrays, and re-allocate the one
involved to have more space.
John Chambers
More information about the Comp.lang.c
mailing list