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 22:33:44 EDT (-0400)
  Re: All your radix are belong to us!  
From: Invisible
Date: 1 Aug 2011 04:14:19
Message: <4e36605b@news.povray.org>
On 23/07/2011 06:13 PM, Darren New wrote:
> On 7/23/2011 7:59, Warp wrote:
>> If you access first and check bounds afterwards, that's kind of a bit
>> late, don't you think?
>
> In the first example, he reads, then checks, then writes, and it's not
> unreasonable to think that he's ensuring the write isn't out of bounds
> because the read is harmless. (Yes, there are still architectures where
> *NULL does not trap.)

More to the point, according to the C spec, NULL is not /required/ to 
trap. Ever. The compiler is 100% free to make it do whatever it likes.

Which isn't especially surprising. The surprising thing is that you've 
got code there explicitly to check for a null pointer, and the optimiser 
may or may not end up removing it for you.


Post a reply to this message

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