On Mon, 14 Feb 2011 11:19:24 -0500, Jonathan M Davis <jmdavisp...@gmx.com>
wrote:
On Monday 14 February 2011 06:12:56 Steven Schveighoffer wrote:
On Sat, 12 Feb 2011 17:48:56 -0500, Jonathan M Davis
<jmdavisp...@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.
Well, I agree that it has its valid uses, but I think that such uses are
quite
rare. You shouldn't normally be writing programs that choose to
essentially just
die in the middle of their execution.
The most common case I can think of is usage errors. Typically, a usage
function prints the usage and then exits the program. This can be done
differently, but it's not "wrong" to do it that way.
-Steve