[fpc-pascal] how to expand a set?

wkitty42 at windstream.net wkitty42 at windstream.net
Wed Jun 15 18:20:17 CEST 2016


On 06/15/2016 10:36 AM, Santiago A. wrote:
> El 15/06/2016 a las 15:55, wkitty42 at windstream.net escribió:
>>
>> what is the best/easiest way to increase the size of a set if the set
>> is defined as the following?
>>
>>
>>    const
>>      CMaxCount  = 255;
>>
>>    type
>>      TMsgAreas  = set of 0..CMaxCount;
>>
>>    var
>>      MsgAreas   : TMsgAreas;
>>
>>
>> is a set of sets possible?
> No, the base type of a set must be an ordinal type. Enumeration type and
> integers. And the base type can't have more 255 elements

right... so a set has 0-255 elements and a set of sets would have 0-255 elements 
containing one set of 0-255 elements... if all are used, that gives 0-65535 
elements we can access... or should be able to access... if we can figure out 
how to create it :(

>> how is a set of sets defined?
> No

hunh?

>> how are the elements in the sets accessed?
> ??
> What do you mean with "access"?
> You can't access the element of a set, you can say if the an element is
> in a set or not.

exactly... that's accessing it if it exists in the set...

> msgAreas:=[1..7];
>
> if (2 in msAreas) then .......

yup...

   if (this.messages.area.num in UsersMsgTaggedAreas) then
     begin
       ScanForNewMessages(this.messages.area.num);
       ScanForUserMessages(this.messages.area.num,this.user.name,this.user.nick);
     end
   else
     inc(this.messages.area);

  ;)


-- 
  NOTE: No off-list assistance is given without prior approval.
        *Please keep mailing list traffic on the list* unless
        private contact is specifically requested and granted.



More information about the fpc-pascal mailing list