[fpc-pascal] Set size limit

Jonas Maebe jonas.maebe at elis.ugent.be
Mon Mar 11 10:47:51 CET 2013


On 11 Mar 2013, at 10:39, Mark Morgan Lloyd wrote:

> Jonas Maebe wrote:
>> On 10 Mar 2013, at 15:00, Juha Manninen wrote:
>>> There are no 8-bit CPUs
>>> supported by FPC that would justify it.
>> It is unrelated to 8 bit cpus. Even Turbo Pascal 1.0 ran on a 16  
>> bit cpu.
>
> Provided that one calls a Z80 16-bit :-) More to the point: do any  
> current CPUs have e.g. vector operations that suggest a realistic  
> maximum size?

The current x86's bit test/set instructions support addressing the  
complete 32/64 bit address space. But the original 8086 didn't have  
any vector instructions at all. Again: this limitation is unrelated to  
instruction sets, it's about deciding on a point at which you're going  
to waste a lot of memory by using a plain bitmap.

>> There is a already a test for larger set support: http://svn.freepascal.org/svn/fpc/trunk/tests/test/tset6.pp
>> Nobody has worked yet on implementing it, but if anyone thinks it's  
>> easy to do, please go ahead. For larger sets, especially if they  
>> are sparse, a simple hashtable-based class would probably be much  
>> faster and memory efficient than simply extending the default  
>> implementation though. With operator overloading and generics you  
>> might even be able to use more or less the same syntax as with  
>> built-in sets.
>
> For larger sets... OK, how /does/ one declare a set of UTF-8  
> characters?

An UTF-8 character is not an ordinal data type and hence support for  
"set of <utf-8 character>" is orthogonal to support for larger sets.  
If you store them in strings or arrays, then you need a hashtable of  
strings or arrays (and/or support for sets of strings or arrays, which  
would probably be implemented using... a hashtable).


Jonas



More information about the fpc-pascal mailing list