www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - CTFE question

reply DLearner <bmqazwsx123 gmail.com> writes:
Suppose we have a function fnFoo, capable (under some 
circumstances) of CTFE.

Is it true that if fnFoo(compile-time values) yields a certain 
(compile-time) value, then
fnFoo(same values at execution time) yields the same value at 
execution time?
Jan 24
parent monkyyy <crazymonkyyy gmail.com> writes:
On Saturday, 24 January 2026 at 16:06:03 UTC, DLearner wrote:
 Suppose we have a function fnFoo, capable (under some 
 circumstances) of CTFE.

 Is it true that if fnFoo(compile-time values) yields a certain 
 (compile-time) value, then
 fnFoo(same values at execution time) yields the same value at 
 execution time?
Ussally, but you could always multiply by __ctfe ```d int foo()=>3*__ctfe; unittest{ enum a=foo; assert(a!=foo); } ``` I think theres also floating point math differences that have survived
Jan 24