<div dir="ltr"><div><div><div><div>Hi,<br><br></div>I'm working on a proposal for C++ standardization. It is in a very early phase, I'm looking for directions and techniques.<br><br>I saw something in another proposal what makes me wonder. Please help me understand it.<br></div><div><br></div>Suppose that we need some information from the compiler, and we want it to be accessable from the compiled code. A hypothetical example is a function that queries the current timestamp from the compiler.<br><br></div>namespace std {<br>    constexpr time_t compiler_time(); // intrinsic<br>}<br><div>...<br></div><div>std::time_t ct = std::compiler_time();<br></div><div>std::cout << "I was compiled at " << std::asctime(std::gmtime(&ct)); <br></div><br></div><div><div><div><div>I wonder how is it possible? I would reason like this:<br><br>-it doesn't make sense to evaluate compiler_time() in runtime, so<br>-the compiler should make a guarantee on its evaluation time<br>-its declaration may have an internal flag that prescribes its "early" evaluation.<br></div><div>-it has nothing to do with the constexpr specifier.<br></div><div><br></div><div>Do I think correctly?<br><br></div><div><br></div><div>Thanks,<br><br></div><div>Kalman Keri<br></div></div></div></div></div>