new string mixins -- debug printfs
Walter Bright
newshound at digitalmars.com
Tue Feb 6 10:56:28 PST 2007
BCS wrote:
> Bill Baxter wrote:
>> Here's something fun that's now possible:
>>
>> version(trace) {
>> template Trace(char[] msg="") {
>> const char[] Trace =
>> `writefln("%s(%s): `~msg~`", __FILE__, __LINE__);`;
>
> i'd use
>
> `writefln(__FILE__"("~itoa!(__LINE__)~"): %s), "`~msg~`");`;
>
> file and line get folded and % dosn't mess thing up
>
> COOL
or:
const char[] Trace =
std.metastrings.Format!(
`writefln("%%s", "%s(%s): %s")`,
__FILE__, __LINE__, msg
);
More information about the Digitalmars-d
mailing list