bottom type as parameter or local variable, does that make sense?

Steven Schveighoffer schveiguy at gmail.com
Sat Jan 15 16:02:14 UTC 2022


On 1/15/22 6:02 AM, Tejas wrote:

> Not to put words in HS's mouth, but I think the reason why simply 
> declaring the `noreturn` variable should lead to initialisation is 
> because that's how _all_ variable declarations in D behave, unless you 
> disable default initialisation, at which point it's a compiler error to 
> simply declare the variable.
> 
> `noreturn` not default initializing is therefore a special case, which I 
> feel is undesirable

But noreturn consumes no space. Even if it's not the equivalent of ` = 
noreturn.init`, it's actually initialized just by declaring it.

I feel the odd thing here is the existance of noreturn.init *at all*. 
The reason it does exist is quite simple though -- generic code.

-Steve


More information about the Digitalmars-d mailing list