toHash => pure, nothrow, const, @safe

Jonathan M Davis jmdavisProg at gmx.com
Mon Mar 12 13:46:41 PDT 2012


On Monday, March 12, 2012 21:36:21 Martin Nowak wrote:
> > That could be solved with a @ctfe attribute or something, no? Like, if
> > the function has @ctfe, go through all possible CTFE paths (excluding
> > !__ctfe paths of course) and make sure they are CTFEable.
> 
> Everything that's pure should be CTFEable which doesn't imply that you
> can turn every CTFEable function into a pure one.

I don't think that that's quite true. pure doesn't imply @safe, so you could 
do pointer arithmetic and stuff and the like - which I'm pretty sure CTFE won't 
allow. And, of course, if you mark a C function as pure or subvert pure 
through casts, then pure _definitely_ doesn't imply CTFEability.

- Jonathan M Davis


More information about the Digitalmars-d mailing list