printf and global namespace
Anders F Björklund
afb at algonet.se
Fri Apr 28 08:23:11 PDT 2006
Mik wrote:
> Does printf really need to be in the global namespace anymore?
No, but Walter likes it while debugging so it stays in there...
> Now that writef
> is fully developed, it seems obsolete. I would say that using printf in a
> newer D program is bad style, since writef is much safer and neater. It also
> gives new programmers the wrong idea. Often they'll try to printf dynamic
> character arrays with a "%s", which surprisingly works most of the time, but
> fails whenever the string has no null terminators.
>
> The only disadvantage to this would be breaking some older programs, but they
> could be fixed by just adding an import std.c.stdio . I say that all of the old
> C stdio functions should get out of the global namespace, and back into their
> module where they belong.
I agree completely.
The only thing missing from "writef" is a fully implemented "readf",
or perhaps a "write" version that works without the format characters.
But printf must die!
http://www.digitalmars.com/d/archives/digitalmars/D/bugs/5838.html
--anders
More information about the Digitalmars-d
mailing list