18

Is it:

  • .p
  • .pl
  • .pas
  • .pascal

Or something else?

And will the various Pascal compilers (notably fpc) bork if you don't use the preferred extension?

mcandre
  • 22,868
  • 20
  • 88
  • 147

2 Answers2

23

The most common file extension for Pascal is pas. As for FPC, it uses the pp extension to denote FPC-specific code.

I think there is not a "preferred" extension, but you can't miss by using pas.

Benjamin W.
  • 46,058
  • 19
  • 106
  • 116
Petr Abdulin
  • 33,883
  • 9
  • 62
  • 96
  • 2
    Originally, it was intended to use ".pp" for FPC specific code, so code that used FPC dialects. However this has all blurred a bit since Delphi has implemented many FPC "extensions" since. But .pas, .pp and .lpr and .dpr are fairly normal. The rest is just compatibility with old Pascal compilers (like Unix Pascal and Mac compilers that use ".p") – Marco van de Voort Oct 14 '11 at 18:44
  • I never saw .pl or .pascal btw. At least not on normal systems – Marco van de Voort Oct 15 '11 at 13:34
1

.pl is a bad idea, because it will conflict with both perl and prolog programs.

According to the Wikipedia .pp, .pas, .inc are valid (last one for include files).

You may also check FreePascal Wiki, which describe .pas as

Unit with Pascal code (typically for a form stored in a corresponding *.lfm file)

and .pp as

Pascal code

I believe you should use one of these two depending of your own preferences.

radrow
  • 6,419
  • 4
  • 26
  • 53