Go to the first, previous, next, last section, table of contents.
The GNU Pascal Compiler (GPC) does not yet implement the whole ISO 10206
Extended Pascal standard, not even the whole ISO 7185 Pascal standard.
It is only partially compatible to Borland Pascal and implements only
some isolated features from the PXSC standard. Furthermore, there are
lots of known bugs which will take a long time to be fixed. (Any
help welcome!) Please take this into account when you consider using
GPC for any purpose.
If you encounter a bug with GPC, please check whether it is one of the
known bugs. If not, report it to the GNU Pascal mailing list
gpc@hut.fi
. (But always report it if you solve the problem! ;-)
-
Type checking is mostly what C does, not what Pascal requires, so GPC
does not yet implement a strongly typed language. Although correct
programs compile, incorrect ones compile also.
-
Conformant arrays don't yet work (in general). Until they do, GPC is a
Level-0 Standard Pascal compiler.
-
Schema types are not yet implemented; only String schemas work
(well ... sometimes).
-
String schemas as formal value parameters do not work.
Workaround:
Pass string types with specified capacity instead, i.e. use
Type
WrkString = String ( 80 );
Procedure Foo ( S: WrkString );
instead of
Procedure Foo ( S: String );
-
Initialized Strings and structured variables are not yet implemented.
-
Illegal substrings let crash the compiler rather than triggering an
error message:
str:='1234567890';
i:=8; j:=13;
str:=str[i..j];
-
The `Index' function does not work when the pattern is a char:
Var
C: Char;
S: String ( 80 );
i: Integer;
...
i:= Index ( s, c ); (* "i" always zero *)
It works with `Var C: String ( 1 );'
See section From Borland Pascal to GNU PascalQuickStart Guide for Borland Pascal users.
-
Strings are implemented in a completely different way. They are
not limited to 255 characters with the length being in position
zero, but they are "Schema types" which is something more
complicated.
-
Most of Borland Pascal's System Unit is not implemented, e.g.
`Byte', `Pointer', `LongInt', `move',
`FillChar', `BlockRead', `BlockWrite', `Assign',
String-related functions, ...
Workaround:
Some of the missing data types, procedures and functions are implemented
in a separate compatibility Unit. Check the
contrib
subdirectory
of your GPC distribution.
-
Initialized Strings are not yet implemented; initialized structured
variables do not yet work in all cases.
-
Chars like `#13' or `^M' do not work. Use `chr ( 13 )'
instead.
-
The inline assember does not follow Borland syntax.
-
There is no `private' directive for Objects yet.
-
There are no "Procedural types" but pointers to procedures
instead.
-
There is no `Inline' in Borland sense.
-
`New' and `Dispose' optional tag field arguments are ignored
(warning given, code works).
-
`Gdb' does not yet understand pascal sets, files or subranges. Now
`gdb' allows you to debug these things, even though it does not yet
understand some stabs.
-
`Packed' does not pack. (Implementation dependent, warning given,
code works.)
-
Files of integer subranges that would fit in a byte do not; instead they
are handled as files of integer. This is especially annoying with
`file of 0..255'.
-
Forward referencing pointers generate `dbx' style debugging symbols
by outputting the `.stabs' as an unknown pointer and later it just
outputs the same `.stabs' again, but this time it also tells what
type the pointer points to. This seems to work for `gdb'. As of
this writing I have not checked what happens with `sdb' type
debugging info. It might be that the pointer is left to be a
(void *)
pointer, so you have to cast it in order to output the
object the pointer points to.
Also, we have not tried any other debugger than `gdb'. If you do,
please let us know what happens.
I think that GDB does not yet support the kind of `.stabs'
that should be used to do this correctly:
.stabs ":tanumber=bnumber", whatever
where anumber is the unknown pointer type referenced earlier, and
the bnumber is the type which anumber actually is. This
construct is not required in C.
-
When debugging, please note that the Initial Letter In Each Identifier
Is In Upper Case And The Rest Are In Lower Case. If you wish to call
C-routines declare them with the "C" directive, as follows:
Procedure FooBAR(i:integer);c;
This makes the external name to be `_foobar'
(replace _
with you machine prefix.)
Procedure FooBAR(i:Integer); External;
Uses external name _Foobar
.
It is done like this to reduce name clashes
with `libc.a' and other possible libraries.
-
All visible GPC runtime system library routines are
named
_p_...
.
-
However, the main program name is not capitalized. (This is a kludge;
see above.)
Go to the first, previous, next, last section, table of contents.