Pascal Viandier wrote:
Hi GPC crew,
I just got into a new issue in my SUN Pascal to GPC conversion process:
In SUN Pascal, one can compare records variables (of the same or compatible type, obviously) with the "=" and "<>" logical operators and obviously enough, ">=" and "<=" cannot be used to compare records, it is meaningless.
It looks that GPC does not implement records comparison. The compiler reports: invalid operands to `<>'. I consulted the ISO 10206 Standard but I don't find anything about records comparison in the logical operators section. It looks like a SUN Pascal extension (one more :-() So, is there a way compare records of compatible types without doing it field by field? I know I can create new operators "=" and "<>" but in this case I will have to do it for the 600+ record types of the applications. There must be a better way to do it... In C, a simple memcmp() call could do the job :-(
You can call memcmp from Pascal also, but what about pad bytes and pad bits ? When there are pad bytes and bits, records can exist that are logically the same, but with different memory layouts ...
Regards,
Adriaan van Os