best replacement for - cout << "hello D" << endl; ?

Bill Baxter dnewsgroup at
Wed Jul 11 19:42:21 PDT 2007

Carlos Santander wrote:
> Bruce Adams escribió:
>> and type safe compared to:
>> stdout.writefln("%s%s%i", foo,bar,2);
> D has typesafe variadics, so you can just say:
> dout.writefln("%s%s%s", foo,bar,2);

Or just dout.writefln(foo,bar,2); in this case.

> %s doesn't mean "pretend it's a string," but rather "write its string 
> representation."

I agree that compile time type-checked format parameters would be nice.

   writefln("%d", someObject);

   >> ERROR: someObject is not an integer

Would be nice.  A couple of people were trying to get this to work using 
compile time string processing.  Maybe they'll pipe in here at some point...


More information about the Digitalmars-d-learn mailing list