|Top Previous Next|
What is translated > operator precedence
In complex expressions, rules of precedence determine the order in which operations are performed. Delphi has four levels:
The first level is the highest precedence and the fourth level is the lowest. The equivalent operators are spread in C++ on 11 levels.
To reproduce the order in which expressions are performed in Delphi appropriate parenthesis must be inserted in C++.
For example, while in Delphi the And and Or operators have a higher priority than the equality operators, in C++ equality operators are evaluated first. So at the translation of the following condition:
if attr And flag = flag then
according parenthesis are set in the C++ output:
if( ( attr & flag ) == flag )
This page belongs to the Delphi2Cpp Documentation
|Delphi2Cpp home Content|