www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - small mistake in http://www.digitalmars.com/d/ctod.html

reply "Lionello Lunesu" <lionello lunesu.remove.com> writes:
under the heading "Formatted printing".

Apart from the fact that the D code uses printf (running gag), is uses 
"import stdio;" which should probably be "import std.c.stdio;" ? It also 
would be a great place to mention the %.*s trick and writefln, I think.

L. 
Oct 20 2006
parent Stewart Gordon <smjg_1998 yahoo.com> writes:
Lionello Lunesu wrote:
 under the heading "Formatted printing".
 
 Apart from the fact that the D code uses printf (running gag), is uses 
 "import stdio;" which should probably be "import std.c.stdio;" ? It also 
 would be a great place to mention the %.*s trick and writefln, I think.

The D way shouldn't mention printf at all. It should just use writef(ln). That way, it would be consistent with other examples. Some of them give an example in C that happens to work in D as well. But the whole point is to show how it can done more nicely in D, and so they don't repeat the C solution when giving the D solution. Stewart. -- -----BEGIN GEEK CODE BLOCK----- Version: 3.1 GCS/M d- s:- C++ a->--- UB P+ L E W++ N+++ o K- w++ O? M V? PS- PE- Y? PGP- t- 5? X? R b DI? D G e++++ h-- r-- !y ------END GEEK CODE BLOCK------ My e-mail is valid but not my primary mailbox. Please keep replies on the 'group where everyone may benefit.
Oct 22 2006