Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The example you gave is actually different code and are not directly comparable. With i = 0; x = array[i++] will access the first element, x = array[++i] will access the second element. So of course in the second case the array load will wait until it gets the incremented value.

Edit: The same code with a preincrement notation would be x = array[i]; ++i;



The cited statement accounts for this:

    > Obviously, the initial value of i must be adjusted
    > if you change pre-increment to post-increment.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: