POV-Ray : Newsgroups : povray.off-topic : Teach yourself C++ in 21 days : Re: Teach yourself C++ in 21 strange malfunctions Server Time
29 Jul 2024 18:16:00 EDT (-0400)
  Re: Teach yourself C++ in 21 strange malfunctions  
From: Darren New
Date: 21 Apr 2012 00:05:47
Message: <4f92321b@news.povray.org>
On 4/20/2012 1:07, Invisible wrote:
>>> (And besides, any kind of detection of this cannot be 100% accurate,
>>> as the problem "will this line of code ever be reached?" is unsolvable
>>> in the general case.)
>>
>> But detecting type errors isn't 100% accurate either.
>>
>> int x = 1 ? 5 : "hello";
>>
>> That's not legal, but it's not a type violation either.
>
> The general problem of determining whether every possible code path is
> well-typed is undecidable. Type systems insert artificial restrictions to
> /make/ the problem decidable. Hence, there are expressions and statements
> which are well-typed, but do not type-check.

Which is the point I'm making. We put up with saying "that'll never be the 
wrong type, but it's still illegal", so the argument that "whether this code 
is reachable is unsolvable, so we shouldn't even try" is equally bogus.)

-- 
Darren New, San Diego CA, USA (PST)
   "Oh no! We're out of code juice!"
   "Don't panic. There's beans and filters
    in the cabinet."


Post a reply to this message

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