by my references, I read that the below (x = n if no break) is true. However should that not be the case, and Keil can change it there is a great risk, thus I'd like another read on it.
a for loop
for ( x = 0 ; x < n ; x++) { ....... if (cond) break; ....... } if (x = n) { // there was no break
can I count on x = n if 'cond' was never met and no break happened?
If that is not something that Keil can change, but standard, I can save a bunch of flags
Erik
Oh: and before I forget, let me remark that this situation:
about C my references are a bit unclear re this
by my references, I read that the below (x = n if no break)
urgently calls for some trashing of "C references" that aren't worthy of the space they occupy on the shelf.
Both references I have DO state something about this; however not in the form "at exit .... They both describe "evaluation sequence" neither states that the increment is mandatory if the loop will exit anyhow.
Both references I have DO state something about this; however not in the form "at exit ....
That is because:
They both describe "evaluation sequence" neither states that the increment is mandatory if the loop will exit anyhow.
The evaluation sequence, plus knowledge of what the operators '=', '<' and '++' do give you all the information you need to determine the value of your variable 'x' at exit of the loop.
The book can't possibly anticipate every question that might arise from the reader's reluctance, or inability, to understand the information it does provide.