proposed @noreturn attribute

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Mon Jul 17 16:01:40 PDT 2017


On 7/16/2017 5:41 AM, Timon Gehr wrote:
> struct S{
>     T x;
>     Bottom everything;
> }
> 
> turns the entire struct into an empty type. It is therefore most natural to say 
> that Bottom.sizeof == ∞. (It's the only choice for which S.sizeof == 
> Bottom.sizeof.)
> 
> Another way to think about it: If something of type A* converts to something of 
> type B* without problems, then one would expect B.sizeof <= A.sizeof. This would 
> imply that Bottom.sizeof >= size_t.max. (Because Bottom* converts to all other 
> pointer types.)
> 
> One small issue is that one needs to avoid overflow for the size of a struct 
> that has multiple fields where one of them is of type Bottom.
> 

But if Bottom does not exist, then S doesn't exist either, and hence the < size 
relationship has no meaning.

(Reminds me of divide by 0 discussions in calculus class.)


More information about the Digitalmars-d mailing list