views:

12

answers:

2

Hi!

I'm developing a c++ application with Xcode 3.1.4 while debugging, if i step into a constructor, i see only the membervariables, but no locals used in the constructor.

does anyone know that problem and how to solve it?

A: 

It may be a bug in the compiler such as this one. You could try upgrading your g++ or using a different compiler.

teukkam
A: 

Obvious question: you're running with no optimizations (-O0), correct? With optimizations, it is very common for local variables to be optimized out. Even without optimizations, I have found that a lot of simple C++ seems to get hidden. For instance, you can't always call get() on a shared_ptr because it gets inlined.

I recommend upgrading to Xcode 3.2. I feel that C++ support improved somewhat between 3.1 and 3.2. That said, C++ support within Xcode is still very weak. Unless you need the portability of C++ (as I do), I do not recommend developing Mac or iPhone apps in C++. You will fight the system all day. It is far better to just learn ObjC and use it (besides, ObjC really is a very powerful language and works extremely well with Cocoa). Even when you need the portability of C++, I recommend isolating the C++ code into a core and wrapping it up in Objective-C.

In no case should you use much ObjC++. gdb gets extremely confused in my experience with ObjC++. If you're going to write in C++, wrap your ObjC. If you're going to write in ObjC, wrap your C++. But don't try to write in both at the same time if you ever plan to use the debugger.

Rob Napier