From line 149 to line 146 without goto!

Started by
0 comments, last by Oxyd 20 years, 1 month ago
I wrote this code:

146: VirtualPtr  p1;
147: VirtualPtr  p2;
148: 
149: p1 = v.getMemory  ();
150: p2 = v.getMemory  ();
 
When I step-debug (step) it, it jumps from the line 149 back to the 146. Anyone knows what is it supposed to mean? It''s compiled using g++ 3.2.2 and debugged using gdb. Oxyd --- - Unreadable code is code written on a piece of paper, but not the one, in which the programmer is using a space in the place you don''t. - Real programmers aren''t afraid of goto
Advertisement
I don''t know for sure how GCC optimizes, but in this case I believe the compiler realized your code was creating a var and then initializing it later without using it anywhere before initialization.

Then it just combined the declaration with initialization, realizing there would be no repercussions.

daveandrews.org - a Christian Programmer''s Weblog | Dusty Engine - a task engine using Irrlicht | Computer Guys Run the World
How to be a Programmer

This topic is closed to new replies.

Advertisement