@noreturn property
Iain Buclaw
ibuclaw at ubuntu.com
Fri Oct 22 09:02:53 PDT 2010
== Quote from Rainer Deyke (rainerd at eldwood.com)'s article
> On 10/21/2010 11:37, Iain Buclaw wrote:
> > Not sure what you mean when you say that void has only one possible value. To me,
> > 'void' for a function means something that does not return any value (or result).
> > Are you perhaps confusing it with to, lets say an 'int' function that is marked 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 at the moment, it should be.
> auto callFunction(F)(F f) {
> return f();
> }
> void f() {
> }
> callFunction(&f);
Oh, I get you. If I were to go along with your null_type idea then, I guess
'volatile' would be as good as any keyword/type to say that this function does not
return.
More information about the Digitalmars-d
mailing list