[Issue 3921] Compile time evaluation requirements not well-specified

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Mar 10 11:22:00 PST 2010


http://d.puremagic.com/issues/show_bug.cgi?id=3921


Don <clugdbug at yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clugdbug at yahoo.com.au


--- Comment #1 from Don <clugdbug at yahoo.com.au> 2010-03-10 11:21:59 PST ---
Quoting the spec:

"In order to be executed at compile time, the function must appear in a context
where it must be so executed"

Note the word MUST. I don't see anything in the spec to indicate that it is
optional. It's pretty simple actually -- if the compiler *needs* a constant,
and it sees an expression, it attempts to constant-fold that expression. If the
expression contains a function call, CTFE will be used. CTFE is not used in any
other context - it never happens unless requested.

> Other writing I've seen suggests that CTFE is an optimization, not a language
requirement.

Can you remember where you saw that writing, or got that impression? If it's
anywhere public, we need to get rid of it, since it is not correct.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list