We got another newcomer asking about how to successfully print things with printf() on the newsgroups again. Being an avid anti-printf crusader, I decided to see how often printf really appeared in the specs. I found a veritable _hornet's nest_ of heresy. In an attempt to spread the True Way of D (writef[ln]), I hope that these vile creatures will be exiled from our fair kingdom for good. Here's a list: code_coverage.html Twice in the sieve program (and shows up in the coverage example as a result). cppstrings.html Several times in the wc program. cpptod.html In the D examples in the "recursive templates" and "meta templates" sections. ctod.html In "formatted printing" it says "printf rules." This is most certainly not true ;) It should say "printf is not typesafe or threadsafe and doesn't understand most of D's types. Use writef[ln] instead." In the "variadic function parameters" example. declaration.html: In two examples for typeof(). dll.html: A printf massacre. expression.html: Strangely confined to cases 1, 2, and 3 of is() expressions. function.html: Two major examples in the section about D variadic arguments use printf profusely. html.html: The code uses printf. mixin.html: OH MY PRINTF. Not a single writef[ln] on the page. overview.html: Again, the sieve program uses it. statement.html: Lots in foreach and try-catch-finally statement examples. template.html: One in the "Tuple Parameters" section. tuple.html: The "Putting it all together" example has two of them. version.html: One in the "debug specification" section. phobos/std_intrinsic.html: Tons. phobos/std_outbuffer.html: Well the class itself has printf() and vprintf() methods with no writef alternatives, which kind of shows this class's age. In addition, I found a few pages which don't seem to be used anymore, and can probably just be deleted: phobos.html, std_format.html, std_openrj.html, std_stream.html Note that these are all in the html/d directory, not html/d/phobos.
(Originally posted on digitalmars.D.bugs) Indeed. They are making D look bad. There'll be newbies not only trying to figure how to get it to work, but also thinking "Oh h**l, D hasn't even replaced the printf abomination", when it isn't even true.
Fixed DMD 1.018 and DMD 2.002
The fixes for ctod.html, dll.html and mixin.html (since renamed template-mixin.html) have been mysteriously left out of the update.
That said, are the instances in dll.html anything to do with avoiding using writef (and thereby possibly allocating GC memory or relying on objects not yet constructed) before the GC is set up? Even if this is so: - It ought to be explained clearly on the page - otherwise, people are likely to 'fix' it while trying it out. - There still might be other suitable functions besides printf that don't rely on anything GC-allocated. Of course, this doesn't affect the fact that ctod.html and template-mixin.html still want fixing.
Fixed dmd 1.023 and 2.007
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル