C++ vs C Debugging: How Hard Is It?

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
3 replies · 2K views
Domenico94
Messages
130
Reaction score
6
How hard is c++ debugging compared to c?
What do you think o f the sentence:
"It s easier to shoot your foot in c. In c++ it s harder, but when you do, you blow away your whole leg"?
Is it really hard( considering the fact code isn t "context free" and it may vary from compiler to compiler, it s more complex, ecc.)
 
Physics news on Phys.org
Personally I think C++ is easier to debug when you get used to it..
Because being object orientated, the developer has to structure the code in some sort of orderly manner.
C on the other hand allows for code spaghetti which can be very hard to comprehend at all if it's not well commented.
(Even by the original author!)
 
It's harder to screw up in C++, but I think it's also easier to debug C++. Since in C you need to get into many small details, it's easier to miss a bug when coding, and harder to find one after the code is written. That quote may come from the fact that C++ usually involves much bigger projects than C ones (games and many Windows apps are written in C++), so it's logic that it's harder to debug those bigger programs (unless we're speaking about operative systems and drivers coding, that are usually coded in C/Assembly).
 
I think the features in a source level debugger are more important than the differences between C and C++. With a good source level debugger, you can inspect variables and/or objects to view their content, while stepping through a program. Break point and trace point features are also nice to have.