Pointer semantics in CTFE

Walter Bright newshound2 at digitalmars.com
Tue May 29 14:57:48 PDT 2012


On 5/29/2012 6:29 AM, Don Clugston wrote:
> I think that's a no-go.
> Implementation-specific behaviour at runtime is bad enough, but at compile time,
> it's truly horrible. Consider that any change to unrelated code can change the
> results. Something that makes it really terrible is that the same function can
> be called in CTFE once before inlining, and once after. Good luck tracking that
> down.
> And at runtime, you have a debugger.

True, but when code relies on undefined behavior, behavior may also differ based 
on compiler settings, link order, compilation order, etc.

Also, note that CTFE can compute different floating point results at compile 
time than at runtime (because CTFE uses 80 bits for everything, even floats).

The solution is to eliminate all undefined behavior, but we can't do that and 
still have a systems programming language.


More information about the Digitalmars-d mailing list