[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

## 3.1 General Changes And Possible Incompatibilies with Previous Versions

This release of GPC has been cleaned up substantially. Consequently, a few old and obsolete features have been dropped or replaced by cleaner, more flexible or otherwise more useful ones. This might lead to minor problems with old programs, but we suppose they're very rare (many programmers might not even know about the old features) and easy to overcome. The most important ones are listed here, the rest of them is contained in the following sections and marked with ``(@)'`.

- The executables ``bpc'`, ``pc'` and ``epc'` as well as the dialect specific behaviour if GPC is invoked by those names have been dropped. What they did was equivalent to ``gpc --borland-pascal'`, ``gpc --classic-pascal'` or ``gpc --extended-pascal'`, respectively, and you can use these forms now. If you need them often, you can put them in scripts or aliases called ``bpc'` etc., of course.

- ``asmname'` in variable and constant declarations must now come after the type (e.g. ``var foo: Integer = 42; asmname 'bar';'`). Furthermore, ``asmname'` doesn't imply ``external'` anymore for variables.

- The internal file handling in the RTS was changed from using ``FILE *'` pointers to integer file handles, to make it more efficient and to get rid of some problems. Accordingly, the ``CFile'` field in ``BindingType'` was replaced by a ``Handle'` field, the ``AssignCFile'` procedure by an ``AssignHandle'` procedure, and the ``GetFile'` function was removed (a substitute is the function ``FileHandle'` which has already existed in previous releases).

- The option ``--no-nested-comments'` (to allow comments like ``{ *)'` as the standard requires) has been renamed to ``--mixed-comments'` (note the inverted value). Accordingly, the compiler directives ``{$N+}'` and ``{$N-}'` have been renamed to ``{$no-mixed-comments}'` and ``{$mixed-comments}'`. The default, when no dialect options are given, is still ``--no-mixed-comments'` (i.e., what used to be ``--nested-comments'`).

- A new option ``--nested-comments'` to allow real nested comments like ``{ { } }'` (also available as a compiler switch, like almost all command-line options). Note the new meaning of this switch, so if you used it before, you'll probably have to change it to ``--no-mixed-comments'` (see above). If nested comments are enabled, comments are also allowed within compiler directives and macros -- however, compiler directives within other compiler directives are still not allowed, and compiler directives within comments are, of course, still ignored.

- C style character escapes (``\n'`, ``\007'` etc.) are now the default for strings enclosed in double quotes, while single quoted strings do not allow them (according to the standard). Accordingly, a verbatim ``"'` in a double quoted string is now obtained with ``\"'` rather than ``""'` (but a verbatim ``''` in a single quoted string still with ``"'`, of course). Therefore, the option ``--[no-]char-escapes'` and the compiler directives ``{$E+}'`/``{$E-}'` have been dropped. If you used these features, please change to the appropriate kind of quotes.

- Macros are no more expanded in ``--borland-pascal'` and ``--delphi'` modes. Expanding them causes a few problems with strange sources written for BP which use the same name for a conditional define and an identifier. Macros can be turned on/off, independently of the dialect, with the new switches ``--[no-]macros'`. (B)

- Macros and conditionals defined with ``{$define}'` are now case-insensitive. (B) Macros and conditionals defined with ``--define'` on the command line are still case-sensitive for compatibility to other GNU compilers. In addition, GPC provides ``{$csdefine}'` or ``--csdefine'` and ``{$cidefine}'` or ``--cidefine'` to define case sensitive or insensitive macros or conditionals, respectively. If you have defined macros or conditionals with ``{$define}'` and rely on them being case-sensitive, change it to ``{$csdefine}'` now.

- The mechanism for including GPC code into code written in other languages has changed and is now more robust. A header gpc-in-c.h is provided for inclusion of GPC code into C programs, and a demo program GPC_C_Pas (together with C code calling it) is supplied to demonstrate this. (Including C code into GPC programs works as before.)

- The preprocessor is now called ``gpcpp'` (it was ``gpc-cpp'` before). If you have installed an older GPC version, please remove gpc-cpp now. If you have any scripts that refer to gpc-cpp directly, change the reference to gpcpp. If you use DJGPP, and you added the GPC specific sections to djgpp.env as described in the FAQ, please change ``[gpc-cpp]'` to ``[gpcpp]'`.

- In ``--borland-pascal'` mode, GPC now ignores everything after ``end.'`. (This also takes care of "^Z" characters at the end of Dos text files). In particular, multiple units or modules in one file don't work anymore in ``--borland-pascal'` mode. (B)

- GPC has introduced a few new keywords which may break programs that use those names as identifiers. Most of them are only "conditionally reserved", i.e. they act as keywords only in those situations where the keyword makes sense, and can be used as identifiers elsewhere. While this does not eliminate all possible conflicts, it avoids a number of them. Among the new keywords are ``attribute'`, ``class'` and ``published'`. (D, partly)

[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

This document was generated by Frank Heckenbach on May, 10 2002 using texi2html