|
![](/i/fill.gif) |
Orchid XP v8 <voi### [at] dev null> wrote:
> >> ...OK, I'm scared. o_O
> >
> > Why?
> A language where the language spec specifically allows you to optimise
> away bounds checks, null checks and so forth in the name of performance?
> Yeah, sounds fairly scary to me.
If you access first and check bounds afterwards, that's kind of a bit
late, don't you think? That's the whole point. If you access before making
the bounds check, then the compiler can assume that the checking is useless.
(The check won't do anything useful because the accessing has already been
made by that point, so the check won't retroactively make it work.)
If you make the check first, and only then access based on that, then the
compiler cannot make the assumption.
> Not having these things automatically is one thing. Automatically
> removing them when the programmer explicitly added them is another. And
> apparently even the "experts" get surprised by this behaviour, so...
Well, if the code is accessing out of boundaries, there's a bug. If there's
such a bug, the compiler is free to do whatever it likes. There's nothing
surprising about that.
--
- Warp
Post a reply to this message
|
![](/i/fill.gif) |