Pointer semantics in CTFE
Dmitry Olshansky
dmitry.olsh at gmail.com
Fri May 25 04:23:40 PDT 2012
On 25.05.2012 10:50, Don Clugston wrote:
> The current implementation of CTFE strictly enforces C pointer
> semantics. One of the restrictions is that you cannot perform ordering
> comparisons between unrelated pointers.
> This is important for repeatability: if it was permitted, the results
> would be arbitrary and might vary unpredictably with subtle changes in
> the code, or change between compiler releases.
>
> But, there's an interesting case from bug 7898: the 'inside' operation.
> If p and q are pointers to the same array, then (r >= p && r <= q) is
> true if r points inside that array, and false if it does not.
Isn't indexes just enough for this use case? It's not like pointer
iteration faster/better when you base, end pointer pair.
--
Dmitry Olshansky
More information about the Digitalmars-d
mailing list