Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Assigning pointers of the exact same type won't work in release mode

Status
Not open for further replies.

Lee10

Programmer
Mar 26, 2005
3
SE
Hi

I have two pointer variables both with the same type.
Camera *a;
Camera *b;

But when I try a = b;
a won't take the pointer value of b in release mode, but it dose so in debug mode why is that?

My project is a bit more complicated than this example given here. But it's essens is the same an assignemnt of pointer variables of the same type should just work right?


Thanx for any help explaining why this can happen...

I thought I was seeing unbelivable things when the debugger showed me it just stepping throuw the assignment without actually doing any assigning....

Lee10



 
Sounds like a code generation problem. Try putting a label where the assignment is done e.g.
Code:
prettyplease: a = b;
This normally forces the code generator to generate the code where the label is.
 
Hi

Thanks for your effort but it did help.


Regards Lee10
 
Thanks for your effort but it did help.
The "but" implies that the suggestion did not help.

The "did help" implies that the suggestion helped.


Those two implications are contrary to one another.

You should clarify what you mean so that, if you still need help, people will understand that your problem has not been solved. Otherwise, skimming readers are likely to only read "it did help," assume you're done, and move on.
 
> I thought I was seeing unbelivable things when the debugger
> showed me it just stepping throuw the assignment without
> actually doing any assigning....
Welcome to the world of debugging optimised code.

In debug mode, there is a 1:1 correspondence between the lines of code you wrote, and the sequences of instructions the compiler generated. This is to make debugging a sane process.

In release mode, the compiler has gotten rid of a load of junk (like useless local variables), and rearranged your code so as to produce the most optimal code without changing the overall meaning of your code. It does however mean that on a line by line basis, stepping the code produces some very weird results (like expressions not being assigned, or code being jumped over).

If you want to debug the code, then use debug mode.

--
 
Thanx Salem, chipperMDV and xwb.

The reason for the release (and not the debug version crashed was narrowed down to some other code) Salem is right debugging in release mode is not a funny process you get very paranoid and evavelent, vague and a bit dissy from the experiance that and the fact that I am a bit vague and very holistic (not analytic as most programmers use is makes my writing a bit of a tad. And I sucpect people that are senceative to syntax gramma and logical thinking have a hard time copping with any text I produce.

Hope you can manage

cheers

Lee10

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top