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

C++

Name: Anonymous 2008-09-17 13:47

1) Why do people not like C++?
2) Is C++ a good language to learn programming? Mind you, you don't need to use any of the advanced features.

Name: Anonymous 2008-09-24 6:10

>>40
Yes, compiler optimizes it in case of ints, pointers, etc. So you can write i++; or ++i; And we were used to that in C.
But in C++ you do it to iterators, and suddenly
for(vector<int> iterator it = v.begin(); it != v.end(); it++)
is worse than
for(vector<int> iterator it = v.begin(); it != v.end(); ++it)

because, as >>42 said, compiler doesn't know if ++it works exactly like it++, so it creates a NEW FUCKING COPY (then destroys it) of the iterator EVERY TIME it's incremented.

All because for is such a low-level construction.

A little foreach construct wouldn't hurt. But it certainly won't solve all of C++'s problems, and knowing it, will introduce some more.

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