689 – Clean up the spec printfs! :)

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 689 - Clean up the spec printfs! :)
Summary: Clean up the spec printfs! :)
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dlang.org (show other issues)
Version: D2
Hardware: All All
: P3 minor
Assignee: Walter Bright
URL:
Keywords:
Depends on:
Blocks: 677
Show dependency tree / graph
Reported: 2006年12月14日 18:46 UTC by Jarrett Billingsley
Modified: 2015年06月09日 05:15 UTC (History)
1 user (show)

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description Jarrett Billingsley 2006年12月14日 18:46:51 UTC
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.
Comment 1 Stewart Gordon 2006年12月16日 20:41:25 UTC
(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.
Comment 2 Walter Bright 2007年07月01日 13:28:04 UTC
Fixed DMD 1.018 and DMD 2.002
Comment 3 Stewart Gordon 2007年07月02日 09:44:46 UTC
The fixes for ctod.html, dll.html and mixin.html (since renamed template-mixin.html) have been mysteriously left out of the update.
Comment 4 Stewart Gordon 2007年07月02日 19:55:06 UTC
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.
Comment 5 Walter Bright 2007年11月03日 21:42:04 UTC
Fixed dmd 1.023 and 2.007


AltStyle によって変換されたページ (->オリジナル) /