crash D1 compiler

Extrawurst spam at extrawurst.org
Sun Feb 1 06:03:58 PST 2009


Zorran wrote:
> This code crash D1 compiler (v1.039)
> 
> ============
> import std.stdio;
> 
> void main()
> {
> 	string ss="sample";
> 	printf("%s", cast(char*)(ss+"\0") );
> }
> ===========

do u mean it actually crashes dmd at compile time or do u mean your 
application carshes at runtime?

try:

void foo(char[] ss)
{
     printf("my string is: %.*s\n", ss);
}

documented under: http://www.digitalmars.com/d/2.0/interfaceToC.html 
("Calling printf()")


More information about the Digitalmars-d-bugs mailing list