identify literals

Dom DiSc dominikus at scherkl.de
Fri Jan 24 10:50:15 UTC 2025


Is it possible in D to find out if the parameter given to a 
function is a literal or a compile time constant?

Of course, if it has _only_ parameters known at compile time, the 
function will be executed during CTFE, so I can check for the 
execution time. But if it has also runtime-parameters, it will 
only be executed during runtime. Is it still possible to find 
out, which values are known at compile-time?

They should be immutable, but do they have some other, more 
specific property?


More information about the Digitalmars-d-learn mailing list