On 12/1/2010 11:00 AM, Joseph M. Newcomer wrote:
On Tue, 30 Nov 2010 22:42:36 -0600, Peter Olcott<NoSpam@OCR4Screen.com> wrote:
On 11/30/2010 9:26 PM, Joseph M. Newcomer wrote:
Well, what does the struct have to do with the question? For example, I would store the
range values you show as two values, and consequently there is no issue about "variable
length". Now, if the question was "How can I store an array of integer pairs" then the
answer is a little more obvious: REG_BINARY. It is suggested that REG_BINARY values
always be less than 64K to prevent "Registry bloat"; greater than 64K will introduce
significant performance problems.
I always need to have pairs of integers, yet, I do not know how many I
will need. Very doubtfully more than one thousand, very probably less
than two dozen. These are only guesses.
****
The suggested maximum would tend to favor REG_BINARY. OTOH, are you sure the Registry is
really the best place to keep this (for example, an XML-based configuration file might be
a better choice)
****
If the number of elements in the array is small, I might consider just storing them as key
names 0..n, e.g.,
....\Range\0\first = 1
....\Range\0\last = 7
....\Range\1\first = 22
....\Range\1\last = 37
....\Range\2\first = 41
....\Range\2\last = 44
I am not sure exactly how many different integer pairs I will need. I am
using these to define Character Sets as Unicode CodePoint ranges.
For example for American English we only need:
21-7F (a single range).
Other languages may be much more complicated. I started looking into
Locales, and this looked promising yet too much learning curve. The
method that I propose also has much more flexibility.
I was initially thinking about the key names, but, this must always be
limited to some specific finite number, it does not scale well. I may
not need to scale well, I may never encounter more than very few range
pairs.
****
Actually, you are always limited to some specific finite number, so there is no issue here
about the limit being unreasonable. But it would significantly slow down access if you
had a large number of elements, which is why the limit of a thousand or so suggests
REG_BINARY would be a better choice.
joe
This will be the exact same format required by the ListBox interface.