On 11/03/2011 22:52, David Nadlinger wrote:
On 3/11/11 11:36 PM, Simon wrote:
On 11/03/2011 21:33, Nick Sabalausky wrote:
Unfortunately that makes debugging CTFE a royal pain in the ass since
CTFE
has absolutely zero way to send anything to stdout - […]
[…]
just use:
pragma(msg, CTFE_string);
No, this doesn't quite cut it for debugging CTFE functions: While you
can obviously use pragma(msg, …) to write the *result* of a function
invoked via CTFE to standard output, this doesn't help you if you want
to debug the stuff going on *in* that function itself, for example to
track down one of the numerous CTFE bugs.
David
P.S.: As a last resort to get something printed during CTFE evaluation,
it is possible to use »assert(false, message)« – DMD prints the
(correctly evaluated) message as part of the compiler error message.
Obviously, this screws up compilation though.
Never had a problem myself; and I've used some really hairy string
mixins to create runtime & CTFE functions.
Worse case, when composing functions is to print out the result and copy
into a file and then debug as normal.
It's neither elegant or convenient, but it works.
--
My enormous talent is exceeded only by my outrageous laziness.
http://www.ssTk.co.uk