void pointer casts

Top  Previous  Next

What is translated > void pointer casts

 

In Delphi frequently void pointers are casted to specific pointer types. C++ compilers produce error messages here, if the cast isn't made explicitly. Delphi2Cpp automatically inserts according cast's to avoid such error messages. E.g.

 

var

  a : Pointer;

  b : PInteger;

begin

  b := a;

 

->

 

void *a;

PInteger b;

b = (PInteger) a;

 

 

An according cast takes place, if a pointer to another type is expected as parameter in a function call.

 

List.Add(Item, Pointer(1));

 

->

 

List->Add( Item, (TObject*) ((void*) 1 ) );

 

 



This page belongs to the Delphi2Cpp Documentation

Delphi2Cpp home  Content