Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

C++

Name: Anonymous 2013-03-08 4:06

C++ programs written where the writer has a basic grasp of object orientation are far more secure and reliable than equivalent C programs.

Compare std::string to char*. std::string always cleans up it's own memory in any situation, allocates the right amount every time. char*, you might forget to free, or double free, or not allocate enough memory. Whoops. Basic logic says that C++ programs are better and more secure than C programs.

Name: Anonymous 2013-03-08 4:23

>>1
This may surprise you, but an equivalent to the C++ strings class can be implemented and used from C, and they can be used in an equivalent manner. The only thing C++ has over C in this regard is the implicit destructor call when the local string variable's scope dies, but this can bite you just as often as it can help you. Explicit code for destructor calls makes them easier to follow and understand. Abstracting away a process like that only works when the process is fail safe. In C++ a segmentation fault can be due to implicit destructor calls, which are hard to understand. Destructors may not always be what you want, and insisting that there is only one destructor may be too inflexible for your needs.

You can never claim a program is secure based upon the language it is coded in. You're argument only supports C++ programs having a higher probability of being secure than C programs, which may be true depending on the type of programmers we are talking about here. But it is possible to write rock solid C that is easier to understand and easier to prove correct, than some styles of C++.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List