Jump to content
Tuts 4 You

MSVS 2010 Issue


TBBW

Recommended Posts

Posted

Hi all,

maybe the dummest quest of the day....

but

msvs 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

Posted

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

Posted

Hi,

No I use the answers.

the statement;

var1 = var2 * var3;

var1 = var1 + var1;

should work, but it does not......

regards,

ger

Posted

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)

Posted

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.

Posted

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

Posted

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

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...