[fpc-devel] Modifiers...

Sven Barth pascaldragon at googlemail.com
Mon Jan 29 09:53:12 CET 2024


Am 28.01.2024 um 12:14 schrieb Michael Van Canneyt via fpc-devel:
>
>
>>
>> 2)
>> Is there, or has there once been?
>> (found in the synedit highlighter)
>>   final
>
> final comes after virtual/dynamic. Its supposed to stop you from 
> overriding
> a method. Which is a bit strange because then you should not declare it
> virtual to begin with.

A person that overrides virtual methods does not always have control 
over whether the method had been declared as virtual. With "final" the 
user can tell the compiler that this method won't be overriden anymore 
and thus the compiler can change virtual method calls to direct method 
calls (assuming the compiler knows the class type involved for sure). 
It's similar to the WPO devirtualisation pass the compiler supports just 
without the need to compile the code twice.

Regards,
Sven


More information about the fpc-devel mailing list