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

Frits van Bommel fvbommel at REMwOVExCAPSs.nl
Thu Jul 12 01:13:56 PDT 2007


Bill Baxter wrote:
> 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.

That would cause foo and possibly (if no '%' in foo) bar to be 
interpreted as format strings. The %i can safely be left out though.


More information about the Digitalmars-d-learn mailing list