DM> char* SomeProgramDirectory()
TC>
DM> No matter how many times I use the directory path, I only search for
DM> it once. It gives me a simple "cache" for this value.
TC> That's a neat idea. I'll snag that snippet. The idea
TC> may come in handy in a few things - thanks!
Statics make great memory caches. :-)
DM> If there is space available, realloc *CAN* (but doesn't have to) use
DM> it to grow. When it shrinks, it can *NOT* move
DM> other memory around to
DM> use up the extra space created.
TC> I now see why realloc isn't a very good idea. Another frivolous library
TC> function??
Well, I've used it _ONCE_ in a growable stack... but only once. ;-) The
worst part is that even though realloc is a standard function, it worked on
gcc for OS/2, but failed in one circumstance on gcc for Sun... so I had to
work around their bug. Why? Because it is (properly, IMO) underused, thus
undertested. Fine by me, though. :-)
---
---------------
* Origin: Tanktalus' Tower BBS (1:250/102)
|