#include <iostream.h> int main(int argc, char* argv[]) { int i=0; ++++i; cout<<i<<endl; return 0; }
It works, but isn't that behavior undefined? Doing 2 pre- incraments *could* create 2 copies of the variable, each getting 1 incrament, and the first copy being thrown away. This is the reason ++i++ does not work, and if it does will not produce the intended result always.
Code comment of the week:
bool hack = false; // DO NOT CHANGE THIS EVER
Edited by - BaShildy on December 11, 2001 3:37:28 AM