D's treatment of values versus side-effect free nullary functions

Jim Balter Jim at Balter.name
Sun Jul 25 13:15:57 PDT 2010


"bearophile" <bearophileHUGS at lycos.com> wrote in message 
news:i2g42t$10ce$1 at digitalmars.com...
> Rainer Deyke:
>> (A function that performs I/O is
>> obviously not a candidate for CTFE.)
>
> I don't fully agree, see this enhancement request of mine:
> http://d.puremagic.com/issues/show_bug.cgi?id=3952
>
> Bye,
> bearophile

"performs I/O" refers to the semantics of the running program; the I/O is 
done at the time the function is invoked. I/O done by pragma(msg, ...) or 
ctputs is performed by the compiler, not by the function. Obviously, as 
Rainer said, no CTFE function can perform I/O since that I/O would never get 
performed by the running program.

Also, I think computing compile-time messages is an abuse of CTFE -- it 
certainly isn't its intended purpose. 



More information about the Digitalmars-d mailing list