Oliver Puetz wrote:
I've got some problems with porting programs from borland to gpc. E.g. in the online-manual
http://agnes.dida.physik.uni-essen.de/~gnu-pascal/gpc_5.html#SEC71
is listed, that with
gpc --borland-pascal
maxint and maxlongint will be predefined. But they aren't. What's wrong?
`MaxInt' is defined with or without `--borland-pascal'.
The `--borland-pascal' switch does not enable anything, but it tells GPC to warn about the use of extensions (or some Standard Pascal features) not present in Borland Pascal, thus trying to ensure that your program will still be compilable with BP. The directive does also switch off warnings about certain ugly tricks (like misuse of typed constants as initialized variables) that are inavoidable in Borland-Pascal.
For `MaxLongInt' you are right, it is not predefined indeed. It is defined in the `GPC' unit as `High ( LongInt )':
Program Test;
uses GPC; (* `MaxLongInt' is defined here *)
Const MaxLongestWord = High ( LongestWord );
begin writeln ( MaxInt ); writeln ( MaxLongInt ); writeln ( MaxLongestWord ); end.
On my Linux PC, the output is:
2147483647 9223372036854775807 18446744073709551615
On 64-bit machines, these numbers are higher ... :-)
Hope this helps - and thanks for finding the bug in the documentation -
Peter