I have a C# project configured for x86 platform target. The application works perfectly in WinXP, but it gets problem in Win7. I am using VS2008.
Please see the test code below (the problem: it prints 0 in WinXP and 1 in Win7).
Note: the code also works fine in Win7 if running on Debug mode or adding a line of trace.
Please advise, thanks!
using System;
using System.Windows.Forms;
namespace Hello
{
public partial class MainForm : Form
{
public MainForm()
{
//The problem: it shows "0" in WinXP, and shows "1" in Win7
MessageBox.Show(Test.GetValue().ToString());
Environment.Exit(0);
}
}
public class Test
{
static int a = 0;
static public float GetValue()
{
float b = 0.8149883f;
float x = (696f / b + a);
//Note: it returns 0 if uncomments the line below, otherwise it returns 1
//MessageBox.Show("hello");
return (x - (int)x);
}
}
}