| Author |
evaluation order with increment operators
|
|
| Robert Katz 2004-11-29, 3:58 pm |
| Is there any ambiguity in the following?
while (k < j) print B[++k]
Is it possible that k will be incremented before the while loop is checked?
--
Regards,
---Robert
| |
| Bob Harris 2004-11-29, 3:58 pm |
| In article <C1dod.3295$pX.2941@news.cpqcorp.net>,
Robert Katz <katz@hp.com> wrote:
> Is there any ambiguity in the following?
>
> while (k < j) print B[++k]
>
> Is it possible that k will be incremented before the while loop is checked?
It should not. Yours should be no difference than
while (k < j)
print B[++k]
or
while (k < j) {
print B[++k]
}
If ++K happens before k < j then it should be wrong.
Bob Harris
| |
| William James 2004-11-29, 3:58 pm |
| Robert Katz <katz@hp.com> wrote
> Is there any ambiguity in the following?
>
> while (k < j) print B[++k]
>
> Is it possible that k will be incremented before the while loop is checked?
No.
|
|
|
|