--
@~@ Might, Courage, Vision, SINCERITY.
/ v \ Simplicity is Beauty! May the Force and Farce be with you!
/( _ )\ (x86_64 Ubuntu 9.10) Linux 2.6.32.6
^ ^ 21:44:01 up 2 days 7:24 2 users load average: 1.38 1.19 1.11
不借貸! 不詐騙! 不援交! 不打交! 不打劫! 不自殺! 請考慮綜援 (CSSA):
http://www.swd.gov.hk/tc/index/site_pubsvc/page_socsecu/sub_addressesa
No.
If it was like this:
j = ++i + i ++;
then it would matter.
Do you mean to tell us that you don't know the difference between
pre-increment and post-increment?
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Huh?
Are you saying that
j = i++;
and
j = ++i;
have the same effect?
i++ increments i and returns the old value. ++i increments i and
returns the new value. So, for example, if i were 4 to begin with,
then before the change the code would cause i to become 5 and j to
become 4, and after the change the code would cause i to become 5
and j to become 5.
--
Dan G
Yes, that's what I said (shame on me). Fortunately I do not have to
debug offset by 1 in the j ;)
Then that person could submit change to that program again and again and
got paid as usual. :)
1. change from "j=++i" to "j=i++"
2. change from "j=i++" to "j=++i"
3. go to (1)
--
@~@ Might, Courage, Vision, SINCERITY.
/ v \ Simplicity is Beauty! May the Force and Farce be with you!
/( _ )\ (x86_64 Ubuntu 9.10) Linux 2.6.32.7
^ ^ 17:38:01 up 1:44 0 users load average: 1.08 1.02 1.00
I understood pre- and post-increment. But that line does not really
affect anything critical.
--
@~@ Might, Courage, Vision, SINCERITY.
/ v \ Simplicity is Beauty! May the Force and Farce be with you!
/( _ )\ (x86_64 Ubuntu 9.10) Linux 2.6.32.7
^ ^ 18:37:01 up 2:43 0 users load average: 1.00 1.00 1.00
> I understood pre- and post-increment. But that line does not
> really affect anything critical.
Then the correction should be to delete it completely. My
impression is that j *is* being used later, so the change does
change the observable behavior of the code. (If j is not used
later, of course, you can just remove the assignment
completely.)
--
James Kanze
Maybe you know more about the pre-conditions satisfied when this
particular piece of code is run, but from reading just what you posted
j is used on the very next line, so I would assume it matters whether
it starts at i or i+1.
--
Dan G
If that line was critical, it should have caused a kernel error in the
very beginning... :)
--
@~@ Might, Courage, Vision, SINCERITY.
/ v \ Simplicity is Beauty! May the Force and Farce be with you!
/( _ )\ (x86_64 Ubuntu 9.10) Linux 2.6.32.7
^ ^ 20:04:01 up 1 day 4:10 1 user load average: 1.21 1.11 1.09
Ummmm... if your idea of quality control is that anything that doesn't
immediately crash your kernel can't be too bad, then please don't
submit any code.... ;-P. - Tony
Not if that programmer did something wrong in the very beginning! :)
--
@~@ Might, Courage, Vision, SINCERITY.
/ v \ Simplicity is Beauty! May the Force and Farce be with you!
/( _ )\ (x86_64 Ubuntu 9.10) Linux 2.6.32.7
^ ^ 16:45:01 up 2 days 51 min 1 user load average: 1.05 1.09 1.08
Last time I checked, Linux was written in C. This is comp.lang.c++.
/Jorgen
--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .