POV-Ray : Newsgroups : povray.off-topic : Teach yourself C++ in 21 days : Re: Teach yourself C++ in 21 strange malfunctions Server Time
30 Jul 2024 00:26:40 EDT (-0400)
  Re: Teach yourself C++ in 21 strange malfunctions  
From: Invisible
Date: 20 Apr 2012 04:07:42
Message: <4f91194e$1@news.povray.org>
>> (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.


Post a reply to this message

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