Frank Heckenbach wrote:
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.
AFAIKS the current implementation is against the standard spirit. Namely, according to the standard declaration:
type typea = typeb;
merely introduces new name for `typeb'. And in all other places what matters is the type. To obey this spirit operators should use types, which will eliminate the whole quadratic seach completely. We do have a problem: GPC currently has problems tracking type equality, but fixing type handling should have (IMHO) very high priority.
I think that type and operator handling can be fixed with quite moderate effort. Of course, that would break users of old semantic, who use alternate type name to trigger different operator :(.