[Issue 10522] __FILE__ and other special keywords cannot be used with printf

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Aug 19 07:38:32 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=10522


yebblies <yebblies at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |yebblies at gmail.com
         Resolution|                            |INVALID


--- Comment #1 from yebblies <yebblies at gmail.com> 2013-08-20 00:38:30 EST ---
Neither can string literals!  printf is a c-varargs function, and has no way of
knowing you want the implicit conversion to const(char)*.

Solutions:
printf("-- %s\n", cast(const(char*))__FILE__);
printf("-- %.*s\n", __FILE__.length, __FILE__.ptr);

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list