[fpc-devel] Dangerous optimization in CASE..OF
    Jonas Maebe 
    jonas at freepascal.org
       
    Sun Jul 16 16:49:44 CEST 2017
    
    
  
On 16/07/17 16:34, DaWorm wrote:
> If the programmer builds a case statement on an enum, that includes all 
> of the possible enum values, and also includes an else clause, to me it 
> seems the programmer is implicitly telling the compiler that there is 
> the possibility of illegal values stored in the enum.
Writing unreachable code never has constituted implicitly telling a 
compiler anything in any programming language. At best, you will get a 
warning from the compiler that the code is unreachable.
You don't want a compiler to start second-guessing what you might have 
meant when you wrote something. Everything must be 100% unambiguous.
Jonas
    
    
More information about the fpc-devel
mailing list