Hi,
When I say "compatible types", I say records with the same fields in the same order so I presume the padding bits and bytes would be done the same way. In fact, my exact need is to be able to compare records of the same type but if something can be done about that, it must be seen in a more generic way.
Now, for the memcmp() call, can I do it directly in my Pascal code? I used to call C code from Pascal through Pascal declarations and a C module to make the implementation, all with careful Pascal/C type mappings on prameters. If it is possible to call memcmp() directly, it would be a nice solution for my problem.
Thanks
Pascal Viandier pascal@accovia.com
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