my code is 110% correct; eg no errors and runs properly. see.
int _val; int myfunc2(int val) { _val = val; return _val; }; int Bar(int val) { return _val + val + 1; }; void myfunc1(int val) { _val += Bar(val); }; etc etc etc
it doesnt give me the right answer sometime.
HEEEEEEEELLLLLLLPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP
my code is 110% correct; eg no errors and runs properly.
You're deluding yourself. Even setting aside the pure lunacy of claiming an above-unity percentage of correctness for anything, that code is clearly not 100% correct.
No. That code cannot give you any answer qualifiable as "right" or "wrong" at all, for the simple reason that it doesn't do anything, by itself.
The bandwith wasted for that nonsense could have been put to much better use if you had actually stated a question, instead of just dumping some unrelated shards of code and expecting people to read you minds regarding what you think is actually wrong with it.
Hmmm ...
http://www.keil.com/forum/16227/
which code is better? Please vote: [ ] Totally bug free code [ ] 100% bug free code [ ] 110% bug free code
It is so HARD to write even moderately bug free code. Circumstances might change. Components could be replaced rendering once functioning code useless. Slight differences between processors might induce a huge impact on large program constructs. EMC is always there. System load will determine "correctness", too. Tool chain (settings) might play a role. System that "live on the edge" in terms of timing might fail without warning (I made such a mistake 1.5 years ago only to fix it 3 weeks ago!).
110%?
I believe 70% is optimistic!
I just set the compiler switch --quality=100 and take it from there.
Then I know that if the code goes through the compiler without any reported warnings/errors, everything is dandy. It's the same as with jpeg images - if you drop the quality parameter, you get lossy results.
View all questions in Keil forum