Is the ++-operator well defined in all cases? I tested on this for-
loop and the results differ in c/cl, c/gcc and C#/(cs or mcs).
** c1-c8 are all 1 before this loop
** b1-b8 contain only zeros
** a = 1,2,3...16
for (i = 2; i < 5; i++, c3++, ++c7)
b1[c1] = a[c1++];
b2[c2++] = a[c2];
b3[c3] = a[c3];
b4[c4++] = a[c4++];
b5[c5] = a[++c5];
b6[++c6] = a[c6];
b7[c7] = a[c7];
b8[++c8] = a[++c8];
I understand that this coding-standard (f.x: "b2[c2++] = a[c2];") is
horrible and I will never again use increment on something that is
used more than once in a row. Are there any guides to "good coding
practice" when it comes to increment?
See details here: http://www.pererikstrandberg.se/blog/index.cgi?page=PlusPlusOperator
No. For C, please see the FAQ at <http://c-faq.com/expr/
evalorder1.html> and the directly linked pages. For C#, that is OT in
this newsgroup, and while some people may know the answer, I expect
most won't. You'll get better results in a newsgroup dedicated to that
> Is the ++-operator well defined in all cases?
This is in the FAQ.
Comp-sci PhD expected before end of 2007
Seeking industrial or academic position *outside California* in 2008
Quote of the day "if you don't care which cell of a gets written to,
why write code which seems to write to a at all?"
Pretty much gives a summary of what I was doing :)
Except for the 3 and 7 examples, all of these exhibit undefined
behaviour. DDT (don't do that).
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
Posted via a free Usenet account from http://www.teranews.com
For the record: I posted a similar post in