@noreturn property
Stewart Gordon
smjg_1998 at yahoo.com
Fri Oct 22 06:00:54 PDT 2010
On 21/10/2010 12:54, Iain Buclaw wrote:
<snip>
> @noreturn
What are you taking to be the semantics of '@'?
> void fatal()
> {
> print("Error");
> exit(1);
> }
>
> The 'noreturn' keyword would tell the compiler that 'fatal' cannot return, and
> can then optimise without regard to what would happen if 'fatal' ever did
> return. This should also allow fatal to be used instead of a return or assert
> statement.
<snip>
You'd normally use an exception for this, not an exit or assert. Or
have you a use case for forcing that no catching or cleanup will take place?
Stewart.
More information about the Digitalmars-d
mailing list