In x86 assembly, the overflow flag is set when an add
or sub
operation on a signed integer overflows, and the carry flag is set when an operation o
As many of the other answers have pointed out, INC
and DEC
do not affect the CF
, whereas ADD
and SUB
do.
What has not been said yet, however, is that this might make a performance difference. Not that you'd usually be bothered by that unless you are trying to optimise the hell out of a routine, but essentially not setting the CF
means that INC
/DEC
only write to part of the flags register, which can cause a partial flag register stall, see Intel 64 and IA-32 Architectures Optimization Reference Manual or Agner Fog's optimisation manuals.