Posted April 12, 201213 yr Hi all,maybe the dummest quest of the day....butmsvs 2010 does not compile the '/', '*' and '%' operators....(well it does compile, but the answers are not there.)I had the same issue using excell changed '/' to '-' problem solved.regards,ger
April 12, 201213 yr Compiler settings? If you have optimization on and are not using the results of the operations for anything, the compiler will leave the code out of the final executable because it determines it to be 'redundant'.HR,Ghandi
April 12, 201213 yr Author Hi,No I use the answers.the statement;var1 = var2 * var3;var1 = var1 + var1;should work, but it does not......regards,ger
April 12, 201213 yr What do you mean by "should work"? More importantly, how do you know it "does not"?A few options:- as ghandi said, optimization may remove unused code; sometimes (especially in older versions of VS) they introduce bugs caused by undefined behaviour. temporarily turn them off and check again.- there might be a bug in your code (some of the initial parameters might be flawed to begin with). you could use the code analyzer that comes with VS, sometimes it helps.- your way of checking the results may skew things (are you debugging? use a debug build, and the watch in the VS debugger)
April 13, 201213 yr Care to post an actual code example of what you are trying to compile? Perhaps you are overlooking somethng minor that isn't an actual bug.
April 13, 201213 yr Aside from agreeing wholeheartedly with atom0s and Killboy, there is also the issue of your original post stating that the operators '/' and '%' weren't functioning but in your 'snippet' you don't use either operator, instead using '+' and '*'.As atom0s said, you should post the code in question and that way people can get a proper idea of what is happening. Your snippet still does nothing with the 'var1' result, which the compiler would see as redundant, thus removing it if optimizations are set to do so.HR,Ghandi
April 13, 201213 yr Author Hi all,PROBLEM SOLVED !!As Ghandi stated the outcome of the statement was not used....I 'accidently' marked the line in which I used the outcome using // comment marks.So the compiler removed my statement.Thanks all,ger
Create an account or sign in to comment