Don't use Scanf()

mike knudsen knudsen at ihwpt.ATT.COM
Sat Mar 12 09:06:14 AEST 1988


Good points.  But if you already are using printf() in your
program (with a legitimate need for the formatting) in several
places, then substituting puts() where possible will make
your program object file bigger, not smaller, since
now the puts() code has to be linked in too.
Puts() and putchar() will be a little faster, but when you're
talking to humans who cares?

BTW, I once wrote a large interactive monitor for a free-standing
8086 board, using a C that had no I/O at all.  I wrote routines
to output %2x, %4x, and %5d as well as strings.
Took a lot of calls to do one good printf(),
but it IS possible and such custom I/O may save you bytes.
-- 
Mike J Knudsen    ...ihnp4!ihwpt!knudsen  Bell Labs(AT&T)
    Delphi: RAGTIMER    CIS: <memory failure, too many digits>
	"Just say NO to MS-DOS!"	"OS/2 == 1/2 of an OS"



More information about the Comp.lang.c mailing list