Should unreachable code be considered an error?

Don nospam at nospam.com
Thu Aug 18 11:46:52 PDT 2011


Timon Gehr wrote:
> On 08/18/2011 02:38 PM, Bernard Helyer wrote:
>> Faramir on the Ars forums makes an excellent point:
>>
>> "With the c preprocessor, both theoretically and as it is used in
>> practice, you can easily get dead code in certain compile paths that is
>> live in others."
>>
>> I think template mixins can achieve the same sort of shenanigans. I think
>> warning it is.
> 
> You mean string mixins?
> As string mixins are so much more expressive than C macros, one should 
> actually almost never get trivial dead code in well designed string mixins.

Yes, the equivalent to the C preprocessor is version statements.
Obviously anything wrapped in a version(none) block shouldn't generate 
an "unreachable code" error...


More information about the Digitalmars-d mailing list