PDA

View Full Version : Possible new bug


blarouche
10-07-2009, 03:42 PM
Hi guys,

I think that now even if we forget to put == in an if statement the compiler doesn't report the error.

I spent the whole day figuring out why my new indicator that I just coded in NT7 was not returning expected value. I found out that instead of writing "==" in my if statement I wrote "=". The compiler didn't report the error so it seems that everything was all right.



Bernard

NinjaTrader_Dierk
10-07-2009, 11:51 PM
I could not comment on this for 2 reasons:
- the compiler is from Microsoft .NET. Thus it would be beyond our control what it does. Also: We would not know what essentially changed between .NET 2.0 and .NET 3.5.
- I would think that you could code statements in .NET 2.0 as well where if you left the second "=" it still would compile but of course the meaning would be different.

eDanny
10-08-2009, 09:00 AM
Anytime I forget the second = in NT6.5 the code will not compile.

roonius
10-08-2009, 08:37 PM
Anytime I forget the second = in NT6.5 the code will not compile.

if(x == 2) - true if x equals 2
if (x = 2) - true is x was successfully assigned the value of 2.

Correct me if I am wrong.

NinjaTrader_Dierk
10-08-2009, 11:19 PM
Guys, this is basic C# and definitely outside the scope of what we are able to provide support for (due to bandwidth reasons). I'm sure the web will hold tons of references on operators in C#. I suggest googling.

However, here are some hints:
- "if (x = 2)" will NEITHER compile on NT6.5 nor in NT7
- I'm not aware of ANY constellation where "x=2" would yield true