Re:Why C++ Is Not "Back"
by Someone on Sunday December 02, 2012 @05:00AM
(#4860734)
I would not know the asnwers, possibly because many of them are phrased horribly. Some examples:
"How many ways are there to initialize a primitive data type in C++ and what are they?"
I guess the answer is two: implicitly at program startup or through assignment. But then, maybe he wants to differentiate between int j=0, int j(0), what constructors do in x::x : j(0){}, and whatever.
"What is name mangling in C++ and why is it used?"
There is no name mangling in C++. Some compilers do map names to C-compatible identifiers, but that is not C++'s business.
"What is a copy constructor and when is it used, especially in comparison to the equal operator?"
I do not have the standard at hand, but I would guess it has an equality operator and an assignment operator, or maybe even just 'assignment'.
"What is a Vector?"
What is that capital 'V' doing there? Should I assume a "using namespace std" and an "#include <vector>"?
"Why should you never throw an exception in a destructor?"
There is nothing wrong with throwing an exception in a destructor (well, it is a bit weird). Throwing one from a destructor is the no-no.
"What is the proper way to perform a cast in C++?"
Another trick question or badly phrased. What are the ways to cast values in C++? When are they appropriate?" or something like it would be better.
"How many ways are there to initialize a primitive data type in C++ and what are they?"
I guess the answer is two: implicitly at program startup or through assignment. But then, maybe he wants to differentiate between int j=0, int j(0), what constructors do in x::x : j(0){}, and whatever.
"What is name mangling in C++ and why is it used?"
There is no name mangling in C++. Some compilers do map names to C-compatible identifiers, but that is not C++'s business.
"What is a copy constructor and when is it used, especially in comparison to the equal operator?"
I do not have the standard at hand, but I would guess it has an equality operator and an assignment operator, or maybe even just 'assignment'.
"What is a Vector?"
What is that capital 'V' doing there? Should I assume a "using namespace std" and an "#include <vector>"?
"Why should you never throw an exception in a destructor?"
There is nothing wrong with throwing an exception in a destructor (well, it is a bit weird). Throwing one from a destructor is the no-no.
"What is the proper way to perform a cast in C++?"
Another trick question or badly phrased. What are the ways to cast values in C++? When are they appropriate?" or something like it would be better.