Promoting C++11 and the STL

Pages: 123
See this thread:
http://cplusplus.com/forum/lounge/88581/

My idea is simple: I think we should start writing articles that promote the use of C++'s features and library: iterators, containers, algorithms, lambda functions, and so on. To promote a cleaner "C++ style" over a mixed C/C++ style.
Good luck to you with that...
I agree. Maybe showcase how using more of C++ can be beneficial.
This might be a bit radical, but shooting down what college professors normally teach in a very explicit manner could also open some eyes. The eyes that I speak of are those of the professors and course designers. There are many bad examples available from online course notes from various universities, and I think it might do well to put a few under the knife and expose the problems.

One of the first hits on google:

http://condor.depaul.edu/ntomuro/courses/309/assign/hw3.html

one thing that made me chuckle.

College Professor wrote:
Don't worry about the return type, 'size_t' -- you can think of it as 'int'.


Sorry, but size_t is actually a typedef for volatile uint64_t***** const. I changed it. Seriously though, this is the very reason that many beginners are so utterly clueless.
Last edited on
College professors are the worst when it comes to teaching C++. I think they're all just stuck in the past where all they had was C.
This strlen function is described on p. 233 (and p. 652). Don't worry about the return type, 'size_t' -- you can think of it as 'int'.
If you read that as anything more than "Don't worry about the return type, 'size_t', it will be explained later. For now just think of it as an integer." then that is your problem. Sometimes you need to gloss over some things without taking mass detours to explain things that are not relevant quite yet.

And the C v C++ style is BS as well. You really shouldn't avoid a paradigm of the language just because you think Object Orientation is the mutts nuts.

If you do this, please don't call it the STL. The term is highly ambiguous. If you mean the C++ standard library just say that.
closed account (1yR4jE8b)
STL: standard template library.
@darkestfright
I know what STL stands for. The question is what do you mean when you say STL?

http://www.projectiwear.org/~plasmahh/cpp/factoids.sh
STL can mean: (1) C++ standard library; (2) the library Stepanov designed; (3) the parts of [1] based on [2]; (4) specific vendor implementations of [1], [2], or [3]; (5) the underlying principles of [2]; (6) The parts of [1] only in C++03. So the term is highly ambiguous, and must be used with extreme caution. If you meant [1] and insist on abbreviating, "stdlib" is a far better choice.
And the C v C++ style is BS as well.

What do you mean, is BS?
It means dumping on C because it's procedural.

Oh, and STL isn't the only component of the C++ standard library.
And the C v C++ style is BS as well. You really shouldn't avoid a paradigm of the language just because you think Object Orientation is the mutts nuts.


If you're gonna teach a C++ class, teach a C++ class. You don't have to teach OOP, but teach the language. Don't teach the C subset of the language. When I took a C++ class, the only C++ feature we touched for the first ~6 weeks was iostream (probably because it's easier). Everything else was method-less structs, C-style strings, raw pointers, raw arrays, etc.
Don't teach the C subset of the language.

If you don't teach the fundamentals of C in an intro C++ course, then when would you teach it?

Would you wait for an intermediate course or expert course to cover it, or would you just skip it completely?
Last edited on
If you don't teach the fundamentals of C in an intro C++ course, then when would you teach it?


In a C course. Or just don't teach it. That's something you can pick up on your own if you don't want to offer a C course.
But C is part of, and I would argue fundamental to, C++.
College professors are the worst when it comes to teaching C++.

I would much rather learn from a college professor than a beginner from an online forum. - http://pastebin.com/BSW1fCP7
I would much rather learn from a college professor than a beginner from an online forum.


What was the point of this? Nobody said "hey let's just have beginners on a random forum teach C++ classes".

But C is part of, and I would argue fundamental to, C++.


And should be taught in a C class. You don't go into a calculus class and spend the whole time learning algebra because it's fundamental to it. You learn that in an algebra class.
@ResidentBiscuit
Makes sense to me to do it that way. After all, the OOP part of C++ sits atop the procedural part that it inherited from C. You don't build a house roof-first. Also, you can't have OOP without procedural code, the methods are basically just procedures. OOP is an extension to procedural programming, and you can't build an extension without something to extend.
@Chrisname, refer to my last post. I'm not saying you shouldn't understand the basics of C first. I'm just saying don't teach a C++ class and only actually teach C.
Oddly, when someone asks "should I learn C before C++" people tend to say no and occasionally add that it might teach wrong practices. How do you feel about that?
Pages: 123