Question

I just started using FPC to practice more my old knowledge of Pascal, but now for Linux, then I started seeing much this comment after the 'program' declaration:

{$apptype console}

But is this a best practice comment or a type of declaration?

Was it helpful?

Solution

{$ ...} are not just comments but they are compiler directives.

Here is a list of compiler directives.

Specifically, {$apptype console} tells the compiler to make a console instead of a gui application.

OTHER TIPS

Yes, but contrary to Delphi, in FPC console is default. Delphi has GUI default (*)

Because the defaults vary between Delphi and FPC, it is a reasonable practice to add it, if there is a chance the code must run under Delphi.

(*) strictly speaking not, since the console app flag can also be set using the cmdline. But while thus not 100% mandatory, it is smart to add it in 99.9% of the cases in Delphi.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top