POV-Ray : Newsgroups : povray.off-topic : All your radix are belong to us! : Re: All your radix are belong to us! Server Time
29 Jul 2024 16:20:23 EDT (-0400)
  Re: All your radix are belong to us!  
From: Warp
Date: 23 Jul 2011 10:59:45
Message: <4e2ae1e0@news.povray.org>
Orchid XP v8 <voi### [at] devnull> 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

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.