English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

For example, "Be careful with null pointers."

2006-06-22 02:06:57 · 9 answers · asked by Anonymous in Computers & Internet Programming & Design

9 answers

Memory Handling.
Whatever memory space you occupy by instantiating the objects should be released after your use.
Type Casting should also be taken care.

2006-06-22 02:12:50 · answer #1 · answered by pakaipakai 1 · 1 0

If an object contains a [private] pointer which dynamically allocates memory, such as new, you MUST either declare the copy constructor, assignment operator and possibly delete (especially if the memory is allocated in the constructor), or you must make the copy constructor and assignment operator private.

If you don't take control of these, the C++ compiler will create default ones for you, and they will do shallow copies only. This will cause you many problems, because objects will end up with internal dangling references, and when referenced, the code will core dump with segmentation violation.

2006-06-23 20:54:23 · answer #2 · answered by MarleyTheCat 3 · 0 0

That OOP/OOA has produced numerous failed project and caused a general maintenance nightmare for the software world because so many people don't really understand how to do it right.

Don't let the puritans force you into hard core OOP. Functional is easier to troubleshoot and debug.

2006-06-22 09:12:14 · answer #3 · answered by sideshot72 3 · 0 0

depends how new you are to programming-if you're new, it would probably be which way the "carrots" go, when you're dealing with cout and cin...
cout << "Hello" << endl;
cin >> number;

if you're a little more advanced, it would probably be function declarations---don't write a function without declaring it first...that can cause you lots of hassle when you're trying to figure out what you did wrong:
void Function();

int main()
{
Function();
return 0;
}

void Function()
{
cout << "Hi." << endl;
}

2006-06-22 11:46:35 · answer #4 · answered by Anonymous · 0 0

Semi-colons.

Youll spend more time ripping your hair out trying to figure why the hell something isnt working to realize that you forgot a semi-colon in one line.

2006-06-22 09:17:00 · answer #5 · answered by contraversialmatt 3 · 0 0

Memory handling.. typecasting, pointers.. datastructures using c++..

2006-06-22 09:16:22 · answer #6 · answered by Ruchi 1 · 0 0

put this in a header file

#define true false

and watch the fun :)

2006-06-22 09:10:53 · answer #7 · answered by Caus 5 · 0 0

handling your memory and making sure you dont have any opportunities for buffer overruns.

2006-06-22 09:09:40 · answer #8 · answered by alex_sublime 2 · 0 0

i dont know

2006-06-22 09:11:57 · answer #9 · answered by Anonymous · 0 0

fedest.com, questions and answers