printf and global namespace

mclysenk at mtu.edu mclysenk at mtu.edu
Fri Apr 28 07:37:55 PDT 2006


Does printf really need to be in the global namespace anymore?  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.

-Mik





More information about the Digitalmars-d mailing list