G
Guest
byte[] Name = new byte[256];
uint len = (uint)Name.Length;
uint err = MyFunction(devID, out Name[0], out len);
When this code is run in release build with optimize code set to true, len
is evaluated to 0. If it is run with optimize code set to false, len is
evaluated as 256 (what i want).
If I add an extra line of code after declaring len, like:
uint foo = len;
then with optimize code on i get 256.
I am happy to build without optimization (it is a small app), but I would
like to know why this happens and if there is a solution.
uint len = (uint)Name.Length;
uint err = MyFunction(devID, out Name[0], out len);
When this code is run in release build with optimize code set to true, len
is evaluated to 0. If it is run with optimize code set to false, len is
evaluated as 256 (what i want).
If I add an extra line of code after declaring len, like:
uint foo = len;
then with optimize code on i get 256.
I am happy to build without optimization (it is a small app), but I would
like to know why this happens and if there is a solution.