Re: Adding noreturn and hidefromvtls attributes

2013-01-11 Thread bearophile
throwEintr (string funcName) pure noreturn { throw new Exception (funcName ~ () was interrupted by the OS); } void exacerbate (T) (const(T) exc, string msg) pure noreturn { throw new T (msg ~ : ~ exc.msg); } If your patch enforcing that a function tagged with noreturn does not return (so

Re: Adding noreturn and hidefromvtls attributes

2013-01-11 Thread Chaiomanot
If your patch enforcing that a function tagged with noreturn does not return (so core.stdc.stdlib.exit must be tagged with noreturn)? It isn't currently compulsory. Any noreturn function will still compile without the attribute. If adopted, it would of course be prudent to make stdlib.exit

Re: @noreturn?

2012-05-16 Thread Steven Schveighoffer
On Mon, 14 May 2012 17:59:19 -0400, Timon Gehr timon.g...@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

Re: @noreturn?

2012-05-16 Thread Timon Gehr
On 05/16/2012 02:27 PM, Steven Schveighoffer wrote: On Mon, 14 May 2012 17:59:19 -0400, Timon Gehr timon.g...@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

Re: @noreturn?

2012-05-16 Thread Steven Schveighoffer
signature. Due to a bug, they are not for DMD. OK, then I would support this as a method of specifying @noreturn BTW, is this bug reported? -Steve

Re: @noreturn?

2012-05-16 Thread Timon Gehr
? Contracts are supposed to be part of the method signature. Due to a bug, they are not for DMD. OK, then I would support this as a method of specifying @noreturn BTW, is this bug reported? -Steve Yes. http://d.puremagic.com/issues/show_bug.cgi?id=6549 Stewart has turned

Re: @noreturn?

2012-05-15 Thread Artur Skawina
On 05/14/12 23:59, Timon Gehr 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

Re: @noreturn?

2012-05-15 Thread Iain Buclaw
On 14 May 2012 22:59, Timon Gehr timon.g...@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

Re: @noreturn?

2012-05-14 Thread bearophile
Alex Rønne Petersen: 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, Maybe Walter will listen you more if you show an example of where/why you would use

Re: @noreturn?

2012-05-14 Thread Alex Rønne Petersen
On 14-05-2012 14:13, Alex Rønne Petersen wrote: On 14-05-2012 13:53, bearophile wrote: Alex Rønne Petersen: 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

Re: @noreturn?

2012-05-14 Thread Alex Rønne Petersen
On 14-05-2012 13:53, bearophile wrote: Alex Rønne Petersen: 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, Maybe Walter will listen you more if you show

Re: @noreturn?

2012-05-14 Thread Iain Buclaw
On 14 May 2012 13:21, Alex Rønne Petersen xtzgzo...@gmail.com wrote: On 14-05-2012 14:13, Alex Rønne Petersen wrote: On 14-05-2012 13:53, bearophile wrote: Alex Rønne Petersen: In writing unwinding mechanisms for my VM, I find myself actually needing some sort of @noreturn function

Re: @noreturn?

2012-05-14 Thread Timon Gehr
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

Re: @noreturn?

2012-05-14 Thread Alex Rønne Petersen
On 14-05-2012 23:59, Timon Gehr 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

Re: @noreturn?

2012-05-14 Thread Timon Gehr
On 05/15/2012 12:14 AM, Alex Rønne Petersen wrote: On 14-05-2012 23:59, Timon Gehr 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

Re: @noreturn?

2012-05-14 Thread Jonathan M Davis
On Monday, May 14, 2012 23:59:19 Timon Gehr 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

@noreturn?

2012-05-13 Thread Alex Rønne Petersen
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

Re: @noreturn?

2012-05-13 Thread Iain Buclaw
On 13 May 2012 17:13, Alex Rønne Petersen xtzgzo...@gmail.com 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

Re: @noreturn ?

2011-12-25 Thread Jonathan M Davis
On Saturday, December 24, 2011 22:26:02 Andrei Alexandrescu wrote: On 12/24/2011 06:58 PM, Vladimir Panteleev wrote: On Saturday, 24 December 2011 at 20:09:46 UTC, bearophile wrote: GNU C has a noreturn attribute since a lot of time. I don't fully understand why such attribute is so useful

@noreturn ?

2011-12-24 Thread bearophile
); #include stdlib.h _Noreturn void abort(void); #include stdlib.h _Noreturn void exit(int status); #include stdlib.h _Noreturn void _Exit(int status); #include stdlib.h _Noreturn void quick_exit(int status); GNU C has a noreturn attribute since a lot of time. I don't fully understand why

Re: @noreturn ?

2011-12-24 Thread Vladimir Panteleev
On Saturday, 24 December 2011 at 20:09:46 UTC, bearophile wrote: GNU C has a noreturn attribute since a lot of time. I don't fully understand why such attribute is so useful in C programs, but is something like a @noreturn function attribute useful in D too? Maybe to implement a better halt

Re: @noreturn ?

2011-12-24 Thread Caligo
On Sat, Dec 24, 2011 at 2:09 PM, bearophile bearophileh...@lycos.comwrote: I don't fully understand why such attribute is so useful in C programs Bye, bearophile Functions are like people. Sometimes they go places that's so beautiful that they never want to return.

Re: @noreturn ?

2011-12-24 Thread Andrei Alexandrescu
On 12/24/2011 06:58 PM, Vladimir Panteleev wrote: On Saturday, 24 December 2011 at 20:09:46 UTC, bearophile wrote: GNU C has a noreturn attribute since a lot of time. I don't fully understand why such attribute is so useful in C programs, but is something like a @noreturn function attribute

Re: @noreturn property

2010-10-25 Thread Steven Schveighoffer
On Fri, 22 Oct 2010 13:22:19 -0400, Stewart Gordon smjg_1...@yahoo.com wrote: On 22/10/2010 03:44, Rainer Deyke wrote: snip A 'void' function returns, therefore it conceptually returns a value. For generic programming, it is useful to treat 'void' as a type like any other, except that it

Re: @noreturn property

2010-10-25 Thread Stewart Gordon
On 25/10/2010 16:18, Steven Schveighoffer wrote: snip I proposed earlier that maybe you shouldn't be able to create void arrays directly. This would help with the contains pointers issue. Indeed, void data is another issue here: http://d.puremagic.com/issues/show_bug.cgi?id=679 Maybe we can

Re: @noreturn property

2010-10-22 Thread Stewart Gordon
On 22/10/2010 03:44, Rainer Deyke wrote: snip A 'void' function returns, therefore it conceptually returns a value. For generic programming, it is useful to treat 'void' as a type like any other, except that it only has one possible value (and therefore encodes no information and requires no

Re: @noreturn property

2010-10-22 Thread bearophile
Ada 95 too has a No_return pragma, see page 12-14 of the PDF file here, it explains various things: http://www.adacore.com/2006/02/02/ada-2005-rationale-exceptions-generics-etc-part-6-of-8/ Bye, bearophile

Re: @noreturn property

2010-10-22 Thread Andrei Alexandrescu
On 10/22/10 19:24 CDT, bearophile wrote: Ada 95 too has a No_return pragma, see page 12-14 of the PDF file here, it explains various things: http://www.adacore.com/2006/02/02/ada-2005-rationale-exceptions-generics-etc-part-6-of-8/ The one cool and interesting thing about non-returning

@noreturn property

2010-10-21 Thread Iain Buclaw
to the compiler to let it know that a function is never going to return. Example: @noreturn 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

Re: @noreturn property

2010-10-21 Thread Bernard Helyer
Thoughts? I really, really like the idea.

Re: @noreturn property

2010-10-21 Thread bearophile
Iain Buclaw: @noreturn void fatal() { print(Error); exit(1); } See also the same feature in GNU C: http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html#index-g_t_0040code_007bnoreturn_007d-function-attribute-2455 Bye, bearophile

Re: @noreturn property

2010-10-21 Thread Lars T. Kyllingstad
of a function body. It would be nice however if you can give hints to the compiler to let it know that a function is never going to return. Example: @noreturn void fatal() { print(Error); exit(1); } The 'noreturn' keyword would tell the compiler that 'fatal' cannot return, and can

Re: @noreturn property

2010-10-21 Thread Steven Schveighoffer
this. Currently in D2, you must either have a 'return' or 'assert(0)' statement at the end of a function body. It would be nice however if you can give hints to the compiler to let it know that a function is never going to return. Example: @noreturn void fatal() { print(Error); exit(1

Re: @noreturn property

2010-10-21 Thread Iain Buclaw
, you must either have a 'return' or 'assert(0)' statement at the end of a function body. It would be nice however if you can give hints to the compiler to let it know that a function is never going to return. Example: @noreturn void fatal() { print(Error); exit(1

Re: @noreturn property

2010-10-21 Thread Lars T. Kyllingstad
. Example: @noreturn 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

Re: @noreturn property

2010-10-21 Thread Justin Johansson
. It would be nice however if you can give hints to the compiler to let it know that a function is never going to return. Example: @noreturn void fatal() { print(Error); exit(1); } The 'noreturn' keyword would tell the compiler that 'fatal' cannot return, and can then optimise without regard

Re: @noreturn property

2010-10-21 Thread Daniel Gibson
)' statement at the end of a function body. It would be nice however if you can give hints to the compiler to let it know that a function is never going to return. Example: @noreturn void fatal() { print(Error); exit(1); } The 'noreturn' keyword would tell the compiler that 'fatal' cannot

Re: @noreturn property

2010-10-21 Thread Iain Buclaw
either have a 'return' or 'assert(0)' statement at the end of a function body. It would be nice however if you can give hints to the compiler to let it know that a function is never going to return. Example: @noreturn void fatal() { print(Error); exit(1

Re: @noreturn property

2010-10-21 Thread Iain Buclaw
this. Currently in D2, you must either have a 'return' or 'assert(0)' statement at the end of a function body. It would be nice however if you can give hints to the compiler to let it know that a function is never going to return. Example: @noreturn void fatal() { print

Re: @noreturn property

2010-10-21 Thread bearophile
Ezneh: I saw something that can be good too about returned values in Nimrod : http://force7.de/nimrod/tut1.html#discard-statement Hope the explanation is sufficient. This way, the programmer knows when he throws away a returned value. I think that could be great too. In C-like languages

Re: @noreturn property

2010-10-21 Thread Rainer Deyke
On 10/21/2010 05:54, Iain Buclaw wrote: @noreturn void fatal() { print(Error); exit(1); } Thoughts? This looks wrong to me. 'fatal' returns type 'void', except that it doesn't. I would prefer this: null_type fatal() { print(Error); exit(1); } Here 'null_type' is a type

Re: @noreturn property

2010-10-21 Thread Iain Buclaw
== Quote from Rainer Deyke (rain...@eldwood.com)'s article On 10/21/2010 05:54, Iain Buclaw wrote: @noreturn void fatal() { print(Error); exit(1); } Thoughts? This looks wrong to me. 'fatal' returns type 'void', except that it doesn't. I would prefer this: null_type fatal

Re: @noreturn property

2010-10-21 Thread Andrei Alexandrescu
On 10/21/10 12:21 CDT, Rainer Deyke wrote: Feel free to think of a better name than 'null_type'. It's a theory classic called none or bottom. It's the bottom of the subtyping lattice, the subtype of all possible types, a type that can never be instantiated. The feature is nice to have but

Re: @noreturn property

2010-10-21 Thread Leandro Lucarella
Daniel Gibson, el 21 de octubre a las 17:15 me escribiste: You want to include in the language what you can do (or at least could) do in GDC using: pragma(GNU_attribute, noreturn)) void fatal() { print(Error); exit(1); } ? Obviously he wants a portable way to do

Re: @noreturn property

2010-10-21 Thread Nick Sabalausky
)' statement at the end of a function body. It would be nice however if you can give hints to the compiler to let it know that a function is never going to return. Example: @noreturn void fatal() { print(Error); exit(1); } The 'noreturn' keyword would tell the compiler

Re: @noreturn property

2010-10-21 Thread bearophile
Nick Sabalausky: One of the nice things about that is you don't have to provide a fake return type. For instance, with your @noreturn: @noreturn int foo() would be legal, but wouldn't make any sence. And in a way, even @noreturn void foo() isn't great since a void return value suggests

Re: @noreturn property

2010-10-21 Thread Leandro Lucarella
bearophile, el 21 de octubre a las 17:35 me escribiste: Nick Sabalausky: One of the nice things about that is you don't have to provide a fake return type. For instance, with your @noreturn: @noreturn int foo() would be legal, but wouldn't make any sence. And in a way, even @noreturn

Re: @noreturn property

2010-10-21 Thread Iain Buclaw
== Quote from Leandro Lucarella (l...@llucax.com.ar)'s article bearophile, el 21 de octubre a las 17:35 me escribiste: Nick Sabalausky: One of the nice things about that is you don't have to provide a fake return type. For instance, with your @noreturn: @noreturn int foo() would

Re: @noreturn property

2010-10-21 Thread Rainer Deyke
as noreturn? A 'void' function returns, therefore it conceptually returns a value. For generic programming, it is useful to treat 'void' as a type like any other, except that it only has one possible value (and therefore encodes no information and requires no storage). If this is not implemented in D

[Issue 1931] dmd doesn't enforce users to use assert(0) for noreturn func

2010-01-15 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=1931 Don clugd...@yahoo.com.au changed: What|Removed |Added Status|REOPENED|RESOLVED

<    1   2   3   4   5