[fpc-devel] Public modifier: brackets or not?

Mattias Gaertner nc-gaertnma at netcologne.de
Sun Feb 23 16:39:54 CET 2020


On Sun, 23 Feb 2020 16:35:28 +0100
Bart via fpc-devel <fpc-devel at lists.freepascal.org> wrote:

> Hi,
> 
> I'm a little confused.
> 
> From:
> https://www.freepascal.org/docs-html/ref/refsu81.html
> 
> This page gives 2 examples.
> 
> Function Second : Real; [Public];
> begin
>   Second := 1;
> end;
> 
> and
> 
> Function Second : Real; Public name ’second’;
> begin
>   Second := 1;
> end;
> 
> In the first, Public is in brackets, in the second it is not.
> 
> However, this will compile also:
> 
> Function Second : Real; [Public name ’second’];
> begin
>   Second := 1;
> end;
> 
> So, what is the correct syntax?

The [] is the old syntax.
It bites attributes, so better not use it.

Mattias


More information about the fpc-devel mailing list