Pointer types [Was: Re: Lints, Condate and bugs]

Walter Bright newshound2 at digitalmars.com
Sun Oct 31 17:02:10 PDT 2010


bearophile wrote:
> Three possible annotations for pointers:
> 
> - @single: this pointer is either null or points to a single element of the
> base type (this disallows the indexing [] syntax).

ref T single = *p;

> - @bound(hi,lo): this pointer is either null or points inside an array of
> given lower and upper bounds.

T[] bound = p[lo..hi];

> - @sentinel: this pointer is useful only for comparisons and not for
> dereference or indexing. This annotation is usually used for pointers that
> point immediately after an allocated area.

T[] sentinel = p[0..0];


More information about the Digitalmars-d mailing list