Re: exit() to end a function

2011-02-14 Thread spir
On 02/14/2011 05:39 PM, Steven Schveighoffer wrote: On Mon, 14 Feb 2011 11:19:24 -0500, Jonathan M Davis wrote: On Monday 14 February 2011 06:12:56 Steven Schveighoffer wrote: On Sat, 12 Feb 2011 17:48:56 -0500, Jonathan M Davis wrote: > There would be some value to having an attribute whi

Re: exit() to end a function

2011-02-14 Thread Steven Schveighoffer
On Mon, 14 Feb 2011 11:19:24 -0500, Jonathan M Davis wrote: On Monday 14 February 2011 06:12:56 Steven Schveighoffer wrote: On Sat, 12 Feb 2011 17:48:56 -0500, Jonathan M Davis wrote: > There would be some value to having an attribute which indicated that a > function > never returns

Re: exit() to end a function

2011-02-14 Thread Jonathan M Davis
On Monday 14 February 2011 06:12:56 Steven Schveighoffer wrote: > On Sat, 12 Feb 2011 17:48:56 -0500, Jonathan M Davis > > 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), > >

Re: exit() to end a function

2011-02-14 Thread spir
On 02/14/2011 03:12 PM, Steven Schveighoffer wrote: On Sat, 12 Feb 2011 17:48:56 -0500, Jonathan M Davis 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 a

Re: exit() to end a function

2011-02-14 Thread Steven Schveighoffer
On Sat, 12 Feb 2011 17:48:56 -0500, Jonathan M Davis 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

Re: exit() to end a function

2011-02-12 Thread Jonathan M Davis
On Saturday 12 February 2011 14:03:09 bearophile wrote: > A small D2 function: > > import std.c.stdlib: exit; > int foo(int x) { > if (x > 0) > return x; > exit(0); > //assert(0); > } > void main() {} > > > DMD 2.051 gives this compile-time error: > test.d(2): Error: function

exit() to end a function

2011-02-12 Thread bearophile
A small D2 function: import std.c.stdlib: exit; int foo(int x) { if (x > 0) return x; exit(0); //assert(0); } void main() {} DMD 2.051 gives this compile-time error: test.d(2): Error: function test4.foo no return exp; or assert(0); at end of function If I comment out the th