*p++ = *p and more

Tainter tainter at ihlpg.UUCP
Fri Apr 4 09:46:38 AEST 1986


> I think compilers can do the post-increment anytime they feel like it
> with in the statement.     The semantics of a[i] = b[i++];   isn't
> defined so the compiler can do whatever it wants.  Even if that means
> that both i's are evaluated before the increment is done.
> Bill Smith
> ihnp4!uiucdcs!wsmith

According to K&R page 42 section 2.8
     ....But the  expression ++n increments n 'before' using its value, while
     n++ increments n after its value has been used.

SO any time they feel like it is not valid.  Indexing a[i] first or
indexing b[i] first IS valid, but b is indexed with the value of i BEFORE
i is incremented.  a can be index either before or after i is incremented.
--j.a.tainter



More information about the Comp.lang.c mailing list