Help index | Search IDC: ExpressionsIn the IDC expressions you can use almost all C operations except:complex assigment operations as '+=' , (comma operation) [] (array indexing, there are no arrays in IDC)You can use the following construct in the expressions: [ s, o ](This means to calculate linear (effective) address for segment 's' offset 'o'.) The calculation is made using the following formula: (s << 4) + oIf a string constant is specified as 's', it denotes a segment by its name. There are 3 type conversion operations: long(expr) floating point numbers are truncated during conversion char(expr) float(expr)However, there is no need in explicit type conversions because all type conversions are made automatically:
- addition:
if both operands are strings,
string addition is performed (strings are concatenated);
if floating point operand exists,
both operands are converted to floats;
otherwise
both operands are converted to longs;
- subtraction/multiplication/division:
if floating point operand exists,
both operands are converted to floats;
otherwise
both operands are converted to longs;
- comparisions (==,!=, etc):
if both operands are strings, string comparison is performed;
if floating point operand exists,
both operands are converted to floats;
otherwise
both operands are converted to longs;
- all other operations:
operand(s) are converted to longs;
There is one notable exception concerning type conversions: if one
operand is a string and the other is zero (0), then a string operation
is performed. Zero is converted to an empty string in this case.
|