@noreturn?

Iain Buclaw ibuclaw at ubuntu.com
Tue May 15 03:13:02 PDT 2012


On 14 May 2012 22:59, Timon Gehr <timon.gehr at gmx.ch> wrote:
> On 05/13/2012 06:13 PM, Alex Rønne Petersen wrote:
>>
>> Hi,
>>
>> If memory serves me right, there were some proposals in the past to add
>> a @noreturn attribute to the language. Where did this go?
>>
>> In writing unwinding mechanisms for my VM, I find myself actually
>> needing some sort of @noreturn function attribute that would tell the
>> compiler that the function does not return, rather than having to insert
>> an assert(false); statement.
>>
>
> What about making the compiler detect this pattern instead of adding an
> attribute? I think it expresses exactly what you want to express, and it
> does not require additional syntax.
>
> void foo()out{ assert(false); }body{ ... }

That would require the function body to be known at compile time,
which may not necessarily be the case (ie: you are linking to C)

-- 
Iain Buclaw

*(p < e ? p++ : p) = (c & 0x0f) + '0';


More information about the Digitalmars-d mailing list