7.1.1 Things that will not work

Here we give a list of things which are dened/allowed in Turbo Pascal, but which are not supported by Free Pascal. Where possible, we indicate the reason.

  1. Duplicate case labels are not allowed. This is a bug in Turbo Pascal and will not be changed.
  2. Parameter lists of previously dened functions and procedures must match exactly. The reason for this is the function overloading mechanism of Free Pascal. (however, the -M (see page 5.1.5) option solves this.)
  3. The MEM, MEMW, MEML and PORT variables for memory and port access are not available in the system unit. This is due to the operating system. Under dos, the extender unit (GO32.PPU) implements the mem constuct. under linux, the ports unit implements such a construct.
  4. There are more reserved words. PROTECTED, PUBLIC, PUBLISHED, TRY, FINALLY, EXCEPT, RAISE are reserved words. This means you cannot create procedures or variables with the same name. While they are not reserved words in Turbo Pascal, they are in Delphi. Using the -Mtp switch will solve this problem if you want to compile Turbo Pascal code that uses these words (chapter 12, page 475 for a list of all reserved words).
  5. The reserved words FAR, NEAR are ignored. This is because Free Pascal is a 32 bit compiler, so they're obsolete.
  6. INTERRUPT will work only on the dos target.
  7. By default the compiler uses AT&T assembler syntax. This is mainly because Free Pascal uses gnu as. However, other assembler forms are available. For more information, see Programmers guide.
  8. Turbo Vision is available under the name of FreeVision, which should be almost 100% compatible with Turbo Vision.
  9. The 'overlay' unit is not available. It also isn't necessary, since Free Pascal is a 32 bit compiler, so program size shouldn't be a point.
  10. There are more reserved words. (see appendix 12 for a list of all reserved words.)
  11. The command-line parameters of the compiler are dierent.
  12. Compiler switches and directives are mostly the same, but some extra exist.
  13. Units are not binary compatible.
  14. Sets are always 4 bytes in Free Pascal; this means that some typecasts which were possible in Turbo Pascal are no longer possible in Free Pascal.
  15. A le is opened for output only (using fmOutput) when it is opened with Rewrite. In order to be able to read from it, it should be reset with Reset.
  16. Destructors cannot have parameters. This restriction can be solved by using the -So switch.
  17. There can be only one destructor. This restriction can also be solved by using the -So switch.
  18. The order in which expressions are evaluated is not necessarily the same. In the following expression:
    a := g(2) + f(3);

    it is not guaranteed that g(2) will be evaluated before f(3).