Lance may correct me, but I believe that the entire "main" RTL is included if you use CHAIN. The RTL is only included in .EXE files, not .PBC (chain) files. When you CHAIN, the RTL is "left behind" for the next PBC file to use. So if an EXE chained to a .PBC module that contained a function like COS (for example) and the original EXE's RTL did not include it, the program could not continue running. But the $LIB metastatements can still be used to control certain parts of the RTL... see ERR 204 and 244 in the PB/DOS docs.
> is WORD as efficient as INTEGER (or DWORD as efficient as LONG)
No. Not nearly as efficient, as I understand it. It's not just a matter of size, but of signed vs. unsigned. The "native DOS" 16-bit data type is INTEGER, and the "native" 32-bit Windows data type is LONG. Using anything else requires the compilers to jump through hoops. (This is true of any compiler, not just PowerBASIC.)
> it is more space efficient to break them up into the common
> and different parts
Not (as I remember it, anyway) for short strings like your examples. If you save (say) 16 bytes by doing that, but the compiler has to use 32 bytes of executable code to add the strings together at runtime, you lose the advantage. (I made up those numbers... I don't know where the actual break-even point is.) But if the first 16 characters are repeated in 10,000 different strings and you can write a function that tacks on the prefix, you might gain some space.
If your primary concern is runtime memory space, then I'd add one "condition" to my advice about using INTEGERs. If most of your numbers are byte-sized and you use a lot of large arrays, you might actually be better off using BYTEs. The arrays themselves would only take up half the space that way. The best example of this is BIT arrays. My largest PB program uses a huge, 3-D true/false array so I create a pseudo-bit-array system using the BIT functions. The arrays end up being 16 times smaller (!) than when I used INTEGERs, and that more than makes up for the additional code that is required to "manage" the non-INTEGER values.
As far as the "overhead" for things like bounds checking goes, it will depend almost entirely on your program. For example, is it array-intensive? All I can really recommend is "try it and see". It should only take a few seconds to re-compile a module with a different metastatement... Less time than typing a message for the BBS...



-- Eric
------------------
Perfect Sync: Perfect Sync Development Tools
Email: mailto:[email protected][email protected]</A>
[This message has been edited by Eric Pearson (edited March 05, 2000).]
Leave a comment: