> Because in boot code you generally don't care about speed, but size is a very important factor.
why can't you have a '#ifdef PREFER_SIZE_OVER_SPEED' or something similar ?
why can't you have a '#ifdef PREFER_SIZE_OVER_SPEED' or something similar ?
Of course you could do all that, but it's so much easier to just override the 5 functions you actually use in your code. Because of the way linkers work and the way standard libraries are designed, if you define your own version of a library function then the linker won't pull in the library version--effectively choosing your local version over the one in the library. That keeps the standard library clean of patches and keeps the small, tight code near the project that actually needs it.