overloading operators for I/O
Bill Baxter
dnewsgroup at billbaxter.com
Thu Feb 15 02:55:26 PST 2007
Michiel wrote:
> Don Clugston wrote:
>
>> I agree. There's another problem -- it really doesn't scale well. With
>> printf, you can do "%3.5f" to print a floating point number with a given
>> precision. With <<, that same operation is really horrible.
>
> But it has the added advantage that there is no need for run-time
> parsing of that string. C++ parses all << stuff at compile time.
>
I wonder how much difference that makes given that most IO tends to be
slow anyway. On a 1 GHz proc, with a disk that has 10msec seek time
that means a hit to the disk can cost you ten million cycles, right?
Spending a few cycles to parse a format string at runtime isn't going to
kill you.
--bb
More information about the Digitalmars-d
mailing list