www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 903] New: Example with printf and string literals crashes

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=903

           Summary: Example with printf and string literals crashes
           Product: D
           Version: 1.00
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: www.digitalmars.com
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: torhu yahoo.com


From http://www.digitalmars.com/d/arrays.html :

"String literals already have a 0 appended to them, so can be used directly:

printf("the string is '%s'\n", "string literal");"

That gives an access violation, because "string literal" is a dynamic array. 
Probably changed with dmd 0.177.  Somehow I wish D would make an exception for
string literals and C functions.  It's too easy to get this wrong when it works
for fixed arguments, just not for variable ones.


-- 
Jan 29 2007
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=903


torhu yahoo.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED





Fixed dmd 1.005.


-- 
Feb 05 2007