[Mono-devel-list] [Patch] RReader not to rely on bounds checking
Willibald.Krenn at gmx.at
Mon Jan 31 07:57:21 EST 2005
Lluis Sanchez schrieb:
> The "using" fix looks OK to me, but I don't see what's wrong on relying
> on array bound checking in this case.
Hmm, and what if the bound checking does not work? (Either by accident
or by intention?)
Furthermore if the abcremoval is working correctly it should be able to
remove the bound check completely (IMO): So we'd still have one 'cmp'
but no exception would be raised in case pos >= len.
If you want to preserve the bound-check catch code, you have to change
the catch clause: Currently, the catch just _swallows_ all exceptions -
ranging from the expected outofbounds, over sigsegvs (if bound checking
does not work) to possibly outofmemory and others.
See Applied Microsoft .NET Framework Programming (p. 418f) for Richter's
comment on catch clauses like this.
This code even catches (and swallows) non-CLS exceptions...
So out of performance, readability and correctness reasons I vote for
More information about the Mono-devel-list