Hello everyone, i am writing about very strange syntax flavor - optimization of interface-inherited classes:
when you're declaring a class derived from interface with interface-addressed functions, the compiler says about unused variables, which is really just used to pass a parameters to com or other outer object, which not met in the current source, e.g typelibrary, COM, OLE - objects/interfaces
Code from CEF4Delphi extension
Unit uCefInerfaces.pas
// TCefBinaryValue
// /include/capi/cef_values_capi.h (cef_binary_value_t)
ICefBinaryValue = interface(ICefBaseRefCounted)
['{974AA40A-9C5C-4726-81F0-9F0D46D7C5B3}']
function IsValid: Boolean;
function IsOwned: Boolean;
function IsSame(const that: ICefBinaryValue): Boolean;
function IsEqual(const that: ICefBinaryValue): Boolean;
function Copy: ICefBinaryValue;
function GetSize: NativeUInt;
function GetData(buffer: Pointer; bufferSize, dataOffset: NativeUInt): NativeUInt;
property Size : NativeUInt read GetSize;
end;
Unit uCEFBinaryValue.pas
TCefBinaryValueOwn = class(TCefBaseRefCountedOwn, ICefBinaryValue)
protected
function IsValid: Boolean;
function IsOwned: Boolean;
function IsSame(const that: ICefBinaryValue): Boolean;
function IsEqual(const that: ICefBinaryValue): Boolean;
function Copy: ICefBinaryValue;
function GetSize: NativeUInt;
function GetData(buffer: Pointer; bufferSize, dataOffset: NativeUInt): NativeUInt;
public
constructor Create;
end;
I get hints or warnings about all of the interfaced functions with parameters, like that:
<<Hint: %s1%(%d1%,%d2%): parameter "%s2" not used>>
Is something going to change in newer versions of lazarus/fpc?