Waldek Hebisch wrote:
I fetched the units and tried on i386. Appearently, running on i386 Linux, the compiler needs 4272 kB (more then four megabytes) to compile the program. AFAIKS the file GPCMacOSAll defines more then 270 variants of the UInt32 type. In the function `get_operator' the compiler performs quadratic search for comparison operator (checking _all_ pairs of variants of UInt32 type). For each pairs of variants the compiler generates appropriate name for possible comparison operator and checks if it is present. The names are allocated on the stack and accumulate.
If looks easy to avoid accumulating names on the stack, but the quadratic search makes the compiler quite slow (at least with your types...).
Basically, the whole operator overloading is a big kludge. I'd have liked to throw it all out, unfortunately there are some who need it ...
Someday it should be reimplemented, but currently it's not very urgent to me.
The attached patch avoids accumulating names on the stack, so it will hopefully solve the memory problem, but not make the compiler faster.
BTW, I'm wondering what these files actually do. GPCStringsAll defines 216 operators for `+' and relations for various string types. GPC has those operations built-in already and they work with any string type (not just the selection defined here)? Also, GPC allows assignments between string types, so the `StrXX[In]ToStrYY' routines are redundant.
I remember we (i.e., Peter N Lewis and me) talked about such operators for "emulating" short strings last year. But this unit uses the regular GPC string types, so it all seems quite pointless to me.
Frank