Don't use Scanf()

Alan T. Bowler [SDG] atbowler at watmath.waterloo.edu
Mon Apr 4 08:32:06 AEST 1988


In article <517 at picuxa.UUCP> gp at picuxa.UUCP (Greg Pasquariello X1190) writes:
>	These are library calls, and although the compiler will generate
>approximately the same function calling sequence, the linker will link in 
>a much larger function in printf().
>

Actually this may or may not be true.  If the library implementor
has carefully built his PRINTF code so that it is can be used
reentrantly (i.e no statics) then it is quite likely that code in
the guts of the library already references PRINTF in order to
give good error messages.  I.e. it may be near impossible to
build a C program that does not include PRINTF.  As always, there
may be good reasons for not using PRINTF in a particular situtation,
but blanket generalizations like "the linker will link in a much
larger function in printf()" just are not true across all implementations.
    Make it correct first, optimize second.



More information about the Comp.lang.c mailing list