Jump to content
efortier

[out] and [in] in records

Recommended Posts

Hi all,

 

I'm trying to find what is the meaning of those and what the compiler does with variables declared with with either [out] or [in], like these:

TMyRecord = record
  [in] SrcPosition: TPoint;
  [out] DstPosition: TPoint;
end;

I've been trying to search on google and in the doc, but all I can find is references to the normal in and out keywords.

 

Thanks!

Share this post


Link to post

VCL.Forms, VCL.Printers and VCL.StdCtrls has a few of these, but for only for function parameters in CLR code.

{$IF DEFINED(CLR)}
type
  TMonitorEnumerator = class
    FList: TList;
    FEnumProc: TMonitorEnumProc; // reference to the delegate so the garbage collector doesnt free it
    constructor Create(List: TLIst);
    function EnumMonitorsProc(hm: HMONITOR; dc: HDC;
      [in] var r: TRect; Data: LPARAM): Boolean;
  end;
{$ENDIF}

and on the topic of CLR: https://stackoverflow.com/questions/2210122/why-are-there-so-many-if-definedclr-in-the-vcl-rtl

Yeah... that stuff really should be made to go away. 

 

  • Like 1

Share this post


Link to post

Indeed ,NET has something called InAttribute and OutAttribute. AFAIK, there is no corresponding thing in Delphi.

Share this post


Link to post
On 8/19/2019 at 2:17 AM, Lars Fosdal said:

VCL.Forms, VCL.Printers and VCL.StdCtrls has a few of these, but for only for function parameters in CLR code.

Right, such examples are using [in] and [out] only for function parameters, not for record fields like in efortier's example.  I've never seen such attributes used on fields.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×