[LLVMdev] Why "I = ++I" instead of "++I" in COFFDump.cpp ?

Robison, Arch arch.robison at intel.com
Fri Apr 4 10:39:52 PDT 2014


tools/llvm-objdump/COFFDump.cpp has two loops that advance the loop iterator using "I = ++I" instead of the usual "++I".  For example:

  import_directory_iterator I = Obj->import_directory_begin();
  import_directory_iterator E = Obj->import_directory_end();
  if (I == E)
    return;
  outs() << "The Import Tables:\n";
  for (; I != E; I = ++I) {
      ...
  }

Is there a reason for writing "I = ++I" instead of "++I" ?

- Arch D. Robison




More information about the llvm-dev mailing list