Parameter types

Top  Previous  Next

What is translated > Routines > Parameter types

Parameters either are passed to routines by value or be reference.Strings are passed as references, but behave as if they were passed by value (because of its copy-on-write technique). Further there are constant parameters and untyped parameters: Different cases of single parameters and how they are converted are listed below. Array parameters are discussed in the array section.

 

 

type

 

MyRecord = record

end;

 

PInteger = ^Integer;

 

 

procedure Foo(param : Integer);

procedure Foo(const param : Integer);

procedure Foo(var param : Integer);

procedure Foo(out param : Integer);

 

procedure Foo(param : String);

procedure Foo(const param : String);

procedure Foo(var param : String);

procedure Foo(out param : String);

 

procedure Foo(param : Pointer);

procedure Foo(const param : Pointer);

procedure Foo(var param : Pointer);

procedure Foo(out param : Pointer);

 

procedure Foo(param : PChar);

procedure Foo(const param : PChar);

procedure Foo(var param : PChar);

procedure Foo(out param : PChar);

 

procedure Foo(param : PInteger);

procedure Foo(const param : PInteger);

procedure Foo(var param : PInteger);

procedure Foo(out param : PInteger);

 

procedure Foo(param : MyRecord);

procedure Foo(const param : MyRecord);

procedure Foo(var param : MyRecord);

procedure Foo(out param : MyRecord);

 

// untyped parameters 

procedure Foo(const param);

procedure Foo(var param);

procedure Foo(out param);

 

->

 

 

->

 

   C++Builder (using DelphiString)                      Other compilers (using std::string)

 

void __fastcall Foo(int param);                     void Foo(int param);                           

void __fastcall Foo(int param);                     void Foo(int param);                     

void __fastcall Foo(int& param);                    void Foo(int& param);                          

void __fastcall Foo(int& param);                    void Foo(int& param);                          

void __fastcall Foo(System::String param);          void Foo(System::String param);                

void __fastcall Foo(const System::String param);    void Foo(const System::String& param);         

void __fastcall Foo(System::String& param);         void Foo(System::String& param);               

void __fastcall Foo(System::String& param);         void Foo(System::String& param);               

void __fastcall Foo(void* param);                   void Foo(void* param);                         

void __fastcall Foo(const void* param);             void Foo(const void* param);                   

void __fastcall Foo(void*& param);                  void Foo(void*& param);                        

void __fastcall Foo(void*& param);                  void Foo(void*& param);                        

void __fastcall Foo(System::PChar param);           void Foo(System::PChar param);                 

void __fastcall Foo(const System::PChar param);     void Foo(const System::PChar param);           

void __fastcall Foo(System::PChar& param);          void Foo(System::PChar& param);                

void __fastcall Foo(System::PChar& param);          void Foo(System::PChar& param);                

void __fastcall Foo(PInteger param);                void Foo(PInteger param);                      

void __fastcall Foo(const PInteger param);          void Foo(const PInteger param);                

void __fastcall Foo(PInteger& param);               void Foo(PInteger& param);                     

void __fastcall Foo(PInteger& param);               void Foo(PInteger& param);                     

void __fastcall Foo(const MyRecord& param);         void Foo(const MyRecord& param);                      

void __fastcall Foo(const MyRecord& param);         void Foo(const MyRecord& param);               

void __fastcall Foo(MyRecord& param);               void Foo(MyRecord& param);                     

void __fastcall Foo(MyRecord& param);               void Foo(MyRecord& param);                     

                                                                                                   

// untyped parameters                               // untyped parameters                          

void __fastcall Foo(const void* param);             void Foo(const void* param);                   

void __fastcall Foo(void** param);                  void Foo(void** param);                        

void __fastcall Foo(void** param);                  void Foo(void** param);                        

 

 

 

Record Parameter Passing in C++

Var Pointer Parameters

String Parameter Passing in C++Builder

Array Parameter

 

 

 

 



This page belongs to the Delphi2Cpp Documentation

Delphi2Cpp home  Content