OTOH, strings must be aligned at least to `Integer' size. (Accessing the Capacity and Length fields requires alignment on some platforms and is at least more efficient on others; accessing the characters can also be more efficient when aligned.) Does your preprocessor take care of this?
Whether you choose to align the length field on an integer-size boundary or not is a decision you could make based on a time versus space trade-off. The macros that I have written happen to store the strings with no gaps at all, and do not do any alignment. If you decided that for your application and platform aligning the strings was better, then you would not use my macros, you would write your own macros, or modify my macros to align the strings. The Pascal Macro Compiler is a general-purpose preprocessor, and can align or not align as the user wishes.
Conclusion: If the strings are known at compile time, the most efficient
way
to store them without gaps is to use the Pascal Macro Compiler. If the strings are not known until run time, the most efficient way is to
allocate a large
block of storage, and move the strings in end-to-end, using a separate
array
to hold either pointers or indices into the large block.
Not necessarily. There are various data structures such as hashes, lists and trees for a reaons. Each have their particular advantages and disadvantages. Which one is best, depends on the application and is not always easy to decide. Claiming that any particular method is "the most efficient" without qualification doesn't give your statements much credibility, sorry.
How you store the strings and how you access the strings are completely separate issues. You can decide to use hash tables, threaded lists, heaps, or trees for accessing the strings regardless of whether you store the strings in a fixed-width table of strings, end-to-end in a character array, or each in a separately allocated block of storage. These decisions can be made independently. I am dealing here solely with the issue of how to store the strings with the least possible amount of wasted space.
At least you got the quoting right this time. :-)
There is no "right" way to do quoting. Different people have different preferences. I simply followed the style that is used in this particular forum.
Frank Rubin
Contestcen@aol.com wrote:
OTOH, strings must be aligned at least to `Integer' size. (Accessing the Capacity and Length fields requires alignment on some platforms and is at least more efficient on others; accessing the characters can also be more efficient when aligned.) Does your preprocessor take care of this?
Whether you choose to align the length field on an integer-size boundary or not is a decision you could make based on a time versus space trade-off.
Unless you don't want to crash your program on some platforms ...
The macros that I have written happen to store the strings with no gaps at all, and do not do any alignment.
So they're not suitable for portable programs.
If you decided that for your application and platform aligning the strings was better,
Not better, necessary!
At least you got the quoting right this time. :-)
There is no "right" way to do quoting. Different people have different preferences. I simply followed the style that is used in this particular forum.
RTF Netiquette!
Frank