A tale of two C's.
Walter Bright
bright at Data-IO.COM
Fri Apr 29 03:33:50 AEST 1988
In article <10604 at steinmetz.ge.com> davidsen at kbsvax.steinmetz.UUCP (William E. Davidsen Jr) writes:
< My desire is to replace print with something which doesn't take up a
<lot of space for F.P. routines if I will call it only with integers.
<Suggestions to the contrary, this would reduce the size of the program,
< I just renamed my routine and use a
< #define print my_print
<to generate the calls. This leaves the code easily portable.
The technique I use is to:
o Make the floating point formatting portion of printf() an internal
function call in a separate file.
o Collect all the names of floating point functions, such as
ecvt(), atof(), _dblmul(), etc.
o Define all these names in a new module called intonly.c, and have
them all resolve to a function which prints an error message and
exits.
o Therefore, when linking, including intonly.obj in the object list
will produce an integer-only program without the overhead of all
those floating point routines.
More information about the Comp.lang.c
mailing list