> (1) Specify the `-lnstdio' library to switch to the "nano formatted I/O"
> stdio routines, which only handle C89 functionality and by default
> exclude floating-point support. This should currently save about 12K of
> space. (I am in the process of adding a more official-looking `-m...'
> switch to GCC for this option.)
> (2) Alternatively, use the (non-standard) routines iprintf(...),
> fiprintf(...), etc. instead of printf(...), fprintf(...), etc. These
> are versions of the "ordinary" formatted I/O routines that support C99
> functionality, but without the floating-point stuff. This saves a bit
> less space --- about 11K.
may I suggest the following trick (it was used (not necessarily
invented by) by MSC in ~1990):
the compiler knows when a module uses floating point;
float x = 1.0;
or
someFunction(1.3);
qualifies as 'uses floating point stuff'
somehow the sprintf group of functions was split in to
general sprintf stuff (most likely format decoding and integer)
and
all floating point formatting stuff
the floating point sprintf stuff was only linked when the program used
somewhere floating point; else floating formatting would only print
'not supported' (IIRC)
main()
{
printf("hello %f", 0x12345678l);
}
would print
hello unsupported
BTW the space savings using this trick were comparable; I remember
~8k. most likely the space required by the floating point emulation
library.
the alternate (2) above will usually end in one module using
iprintf(), the next module printf(); clearly suboptimal.
Tom
_______________________________________________
Freedos-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freedos-devel