Talk:System.SyncObjs.TSimpleEvent

From RAD Studio API Documentation
Jump to: navigation, search

The question posted here points out that we should clarify the issues that C++ code runs into when auto-translated from Delphi. The issues are:

  1. Unlike Delphi, C++ does not inherit constructors. In the case of TSimpleEvent, to understand what the parameters are used for, one must look at the implementation of TEvent's constructor
  2. Unlike Delphi, auto-generated C++ constructors lack the default argument values. In the case of TSimpleEvent and TEvent, this shows up in that typical Delphi code invokes Create with specifying arguments. This is because TEvent's
constructor Create(UseCOMWait: Boolean = False);

The same constructor in C++ is

__fastcall TEvent(bool UseCOMWait)

Hence, this means that in C++ one must specify the false parameter to match the Delphi's argument-free Create.