exit() to end a function

Steven Schveighoffer schveiguy at yahoo.com
Mon Feb 14 06:12:56 PST 2011


On Sat, 12 Feb 2011 17:48:56 -0500, Jonathan M Davis <jmdavisProg at gmx.com>  
wrote:

> There would be some value to having an attribute which indicated that a  
> function
> never returns under any circumstances (likely since it always throws),  
> but that
> wouldn't help exit any, since it's a C function and wouldn't have the  
> attribute.

The bindings to C can be attributed as we see fit.  A C symbol is not  
mangled, and so you can attach any attributes you want (you can even  
change the number and types of parameters).

> Regardless, I see little value in complicating dmd even a little bit  
> more just
> so that you don't have to insert an extra assert(0) after exit -  
> particularly
> when very few programs call exit, and very few should.

I agree with this.

> Generally, something is
> horrendously wrong if exit is being called, and there's probably a  
> better way to
> handle it.

I don't agree with this, exit has its valid uses.

-Steve


More information about the Digitalmars-d-learn mailing list