I am a student of EE who is doing a research about video processing.Most of my classmates, including my seniors, they deem they know c++ but always treat c++ as something ".c with pp"
They refuse to see the existence of template, STL, even
the iostream, they would rather create their double linked list
than using the container from the stl(the worst is I have to manage the memory they allocated);
they prefer to use macro rather than template.
They would laugh at you when you use std::cout rather than printf.
They always like to say something like
"c++ is just like c, why are you bother to use so many unreasonable, complicated features of c++?"
"macro are fine, for a normal people, char is much more easier to
understand than std::string, you should not use string, char is good enough"
"We don't need stl, it is difficult to comprehand and can't beat handcrafted c code"
"Who cares about uing object to manage resources?
free is fine as long as you remember when to release them
(the worst thing is I have to manage their memory)"
Their conclusion is :"stop using those unnecessary features, c is far
more better to read rather than those unreadable code write by your ugly c++ style"
1 2 3 4 5 6 7 8 9
|
std::vector<std::string> names;
names.reserve(10);
std::string temp;
for(size_t i = 0; i < 10; ++i)
{
std::cin>>temp;
names.push_back(temp);
}
std::copy(names.begin(), names.end(), std::ostream_iterator<std::string>(std::cout, "\n"));
|
They say this kind of code is crap(just an example), I should use malloc rather than vector
using for plus printf rather than std::copy and better don't mess up with string
If you are me, what would you do?Or the code like that is really ugly?