new string mixins -- debug printfs

Bradley Smith user at domain.invalid
Tue Feb 6 16:18:30 PST 2007


Walter Bright wrote:
> 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
>      );

Typo. Missing ';' closing writefln statement. Should be the following.

  const char[] Trace =
   std.metastrings.Format!(
        `writefln("%%s", "%s(%s): %s");`,
        __FILE__, __LINE__, msg
      );





More information about the Digitalmars-d mailing list