why value is different?

Started by
7 comments, last by lomateron 11 years, 10 months ago
so i have this line

float vc =dd[0].x;

then i debug to check what the value of vc is

dd[0].x ----> 65503.000

vc ----> -1.0737418e+008


why?

dd is an array of D3DXVECTOR4
Advertisement
Debugging with debugger or by printing values?
[color=#282828][font=helvetica, arial, verdana, tahoma, sans-serif]

[background=rgb(250, 251, 252)]Debugging with debugger[/background]

[/font]

Release or Debug build?

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]

Are you stepping the code through with breakpoints? If the breakpoint is on the line [font=courier new,courier,monospace]float vc =dd[0].x;[/font] then the value you see for [font=courier new,courier,monospace]vc [/font]will be the value before the assignment (at leas in MS Visual C++).
Place a breakpoint after that line and see the values again.

EDIT: maybe in debug build, you should see vc = 0. so if you are in debug build, my post is off, I think.
its the debbuger from visual studio 2010 ultimate
I think your not stepping the debugger through that line. Make sure your break point is set on the next instruction after float vc =dd[0].x; The debugger can reflect random values in variables that are not initialized.

You can verify with

float vc = 0.0f;
vc = dd[0].x;;

vc should be zero instead of a different number if you place the breakpoint at vc = dd[0].x;

Brendon Glanzer


Are you stepping the code through with breakpoints? If the breakpoint is on the line [font=courier new,courier,monospace]float vc =dd[0].x;[/font] then the value you see for [font=courier new,courier,monospace]vc [/font]will be the value before the assignment (at leas in MS Visual C++).
Place a breakpoint after that line and see the values again.

EDIT: maybe in debug build, you should see vc = 0. so if you are in debug build, my post is off, I think.
oo sorry you are right i just had to press f10 again and the value was correct.
that line was to find were the value is changing because the value isn't what it must be in a pixel of 2d texture inside GPU memory so i thought i found it.

This topic is closed to new replies.

Advertisement