From: Andre Majorel (amajorel_at_teaser.fr)
Date: 2001-02-26 03:34:42
On 2001-02-22 16:47 +0100, Ullrich von Bassewitz wrote: > > On Thu, Feb 22, 2001 at 02:01:57PM +0100, MagerValp wrote: > > Does the linker link in unused library functions? > > No, of course not. So you will only get the additional code if you use it. Many programs use only a small subset of all the complexity of printf() and scanf(). If all the format strings are constants, the compiler may determine which features are used and leave out those that aren't. It's not particularly easy to do; it requires printf() and scanf() to be modular. Alternatively, one may derive (via #ifdef) several versions of printf()/scanf() and have ld link the most appropriate one. A significant number of programs use only %s and %d, without any modifiers. There is another contingent that uses only %s, %d, %X with width, precision, justification and padding modifiers ("%-20.20s %04X %3d"). Suppose that %% and %c should be always supported because they're so cheap. Having the compiler parse the format strings may seem incestuous to some but there are precedents. Certain DOS compilers do it to decide whether they need to include FP stuff, and GCC to warn if the fields don't match the arguments. -- André Majorel <amajorel_at_teaser.fr> http://www.teaser.fr/~amajorel/ ---------------------------------------------------------------------- To unsubscribe from the list send mail to majordomo_at_musoftware.de with the string "unsubscribe cc65" in the body(!) of the mail.
This archive was generated by hypermail 2.1.3 : 2001-12-14 22:05:39 CET