Inc and Dec

Top  Previous  Next

User interface > Translation options > Input options > Extended "System.pas" > Inc and Dec

 

As for the procedures for memory management there are template functions for Inc and Dec, e.g.:

 

template <class T>

T Inc(T& xT)

{

  int t = (int) xT;  

  t++;

  xT = (T) t;

  return xT;

}

 

For integer types Inc and Dec are converted automatically to the C++ incrementing and decrementing operators. E.g.

 

Inc( i )  -> i++

 

However in cases, where i is an enumerated type the operators cannot be used in C++. So the translator lets a call like Inc( i ) unchanged and the template function  are called in C++. By the temporary conversions of the enumerates types to integers the Inc and Dec functions will work for enumerated types too.

 



This page belongs to the Delphi2Cpp Documentation

Delphi2Cpp home  Content