At compile time

Don nospam at nospam.com
Thu Aug 6 04:03:39 PDT 2009


Jarrett Billingsley wrote:
> *On Wed, Aug 5, 2009 at 7:23 AM, Ary Borenszweig<ary at esperanto.org.ar> wrote:
>> bearophile escribió:
>>> Jarrett Billingsley:
>>>> C++ has static initialization that occurs before main() too.  It's just..
>>>> hidden.<
>>> I see. I have to learn more about C++. Thank you.
>>>
>>> ------------------
>>> Lars T. Kyllingstad:
>>>
>>>> This is good news! The restrictions you are referring to, are they any of
>>>> the ones documented here:
>>>> http://www.digitalmars.com/d/2.0/function.html#interpretation <
>>> That list has a point regarding what I was trying to do:
>>>> 4. the function may not be a non-static member, i.e. it may not have a
>>>> this pointer<
>>> It's true regarding stucts used as values too, and not just classes...
>> It would be nice if the compiler could say so: "I can't evaluate it because
>> you are using a this pointer". With other words, but much more useful than
>> "non-constant expression".
> 
> Yes, oh my God, this is the main reason I don't use CTFE: debugging
> them is virtually impossible, and the compiler does nothing to help
> there.

Nice error messages for CTFE assignment statements are in the next 
release. That's probably 50% of the instances of "non-constant expression".


More information about the Digitalmars-d-learn mailing list