<p>As a professor who teaches C++17/20(/23: <code>mdspan</code> for scientific computing): the 11 standard was the big evolution, and 14/17 are only minor improvements over it. If you learn C++11 lambdas, it's unlikely you need the 14/17 improvements in your first, maybe even second, semester of coding.</p>
<p>So I'd consider the <code>-std=c++11</code> flag as a minimum for modern C++, as opposed to your grandparent's C++.</p>
<p>That said, I like <code>std::optional</code> and structured bindings, and I teach those. This fall will be the first time I include <code>std::ranges</code> which I think is fairly elegant. Wish me luck :-)</p>
<p><a href="https://theartofhpc.com/isp.html" rel="noreferrer">https://theartofhpc.com/isp.html</a></p>

CC BY-SA 4.0
2023-05-29T19:56:55.943Z
Thanks, and of course good luck!
I_throw_but_dont_catch
CC BY-SA 4.0
2023-05-29T19:32:28.017Z
2023-05-29T19:42:33.473Z
2023-05-29T19:42:33.473Z
Victor Eijkhout
<p>The advantage of C++ for teaching programming is that it is <em>reasonably</em> close to the actual raw workings of the computer whilst being high level <em>enough</em> to teach higher level concepts. The features added in recent versions of C++ are mostly features designed to <em>avoid</em> working with lower level workings so using these features detracts from the pedagogical advantages of C++.</p>
<p>There's also probably some aspect that CS Professors are not necessarily interested in keeping up with the bleeding edge of C++ language design and fashion. These are not relevant to the kind of things that most Computer Scientists are doing. Many departments agree which language to use for base courses at the departmental level and these discussions and any changes can be highly political. This is a considerably obstacle to change.</p>
<p>How well it prepares you for industry depends on where you end up, there are plenty of C++ jobs out there with companies that don't use modern C++ features (the last one I had was using C++14, and used their own libraries rather than STL for most everything). But in any case, fresh graduates are expected to need six to twelve months to become properly productive in the workplace anyway, so it's not a particularly big deal whether or not you've learnt some corner of the STL.</p>

CC BY-SA 4.0
2023-05-28T09:43:55.553Z
2023-05-28T11:25:39.780Z
2023-05-28T11:25:39.780Z
Jack Aidley
<p>In regards to &quot;How does this choice impact students' [...] preparedness for industry standards?&quot;, as a software engineer working in industry (now retired), I would not expect a negative impact based on my experience. Side remark: The use of <code>-Wall -Werror</code> is an industry best practice.</p>
<p>Having worked in a number of Silicon Valley companies I observe that industry is often slow in utilizing new language features for production code, for practical reasons. New language features may be used in research or exploratory code by a small subset of the company's engineers.</p>
<p>The availability of new language features is tied to newer toolchain versions, and most companies value toolchain stability in their development work. It is not out of the ordinary to find a company having standardized on a five year old toolchain, for example because newer versions have been found to contain functional bugs or introduce performance regressions in the company's money-making products. This conservative approach can also be seen in the choice of default compiler offered on various Linux distros, where enterprise level RHEL 8 might ship with gcc 8.x, while at the same time Ubuntu 22 (possibly preferred by researchers and hobbyists) might ship with gcc 11.x.</p>
<p>It is also the case that, for a variety of reasons, different toolchains adopt support for new language standards at different speeds. See the <a href="https://en.cppreference.com/w/cpp/compiler_support" rel="nofollow noreferrer">compiler support matrix</a> at the CPP Reference website for example. This comes into play when a product needs to be supported across multiple platforms, some of which may not be known yet. In that case it makes sense to restrict oneself to the use of a minimum language standard that is supported &quot;everywhere&quot;. From what I can see, at the moment that would still seem to be C++11.</p>

CC BY-SA 4.0
2023-05-29T19:36:38.657Z
`-Wall -Werror`: I tried the other if my codes were clean in that respect. What?! `for ( int i=0; i<myarray.size(); i++)` is not allowed? Fiddle that shirt! Do I seriously have to burden my poor students with the distinction between signed/unsigned 32/64 bit? Ok, you said "industry", but see what forum we are here.
Victor Eijkhout
CC BY-SA 4.0
2023-05-29T19:39:46.450Z
@VictorEijkhout I am well aware that this is CSE. I specifically *only* addressed the part of the question dealing with "industry standards" and stated so up front.
njuffa
CC BY-SA 4.0
2023-05-30T05:29:02.957Z
@VictorEijkhout Unfortunately, yes. At least I was taught about signedness and the bit size of integers (how they're stored in memory, and so on). I really like your attitude toward your students, you seem like a great professor.
I_throw_but_dont_catch
CC BY-SA 4.0
2023-05-30T13:24:22.730Z
@TheCompile-TimeComedian My teaching is "operational": anything my students learn needs to be reinforced with a concrete use case. 1. 32 vs 64 bit ints: I have the hardest time getting them to realize that 10k is not a large number. I don't think int overflow happens much in the first semester coding exercises I give them. 2. signed/unsigned: even more rare to run into. I save 2's complement and IEEE 754 for a more advanced class. So I'm afraid that teaching them `for ( size_t i=....` this will become voodoo programming: just a magic formula they have learned, without understand the why of it.
Victor Eijkhout
CC BY-SA 4.0
2023-05-29T15:52:02.163Z
2023-05-29T16:16:02.023Z
2023-05-29T16:16:02.023Z
njuffa
<p>I'm no teacher, though following the community online I have the impression that too many students are exposed to C++98/03, pre-standard C++ or C in their C++ courses. If they all would be making the jump to C++11, we would give them a better experience.</p>
<p>Personally, I don't see much difference between C++11 and C++17 while the latter provides quite some quality-of-life improvements.</p>
<p>An argument I've heard before was that universities teach what the industry uses. Following that reasoning I would not expect C++20, however C++17 should follow that rule.</p>
<p>I also believe that we, as a community, should make a better stand on what versions our considered outdated. I was glad to see boost drop C++98 requirements, though that's just a first step.</p>

CC BY-SA 4.0
2023-11-08T23:41:03.560Z
I am still in school right now, and I am taking OOP class in C++, Java and C#. Nobody in that class teaches any industry practices since they differ so much it's basically pointless (use of in-house standards). I personally see some noticable differences between C++11 and 17, like lambdas, compile time eval, threading, and STL.
I_throw_but_dont_catch
CC BY-SA 4.0
2023-11-09T05:55:16.227Z
That's what I meant with quality of life improvements. All those things exist in C++11 (except some STL sub libraries) though they became much easier to use. All of them are still the same concepts, so you don't need big reworks of the way you teach them, unlike ranged-for, auto, introduction of lambdas, std::move, std::unique_ptr. All of those where new concepts that really change the way people think about writing code.
JVApen
CC BY-SA 4.0
2023-11-04T22:44:36.287Z
2023-11-04T22:44:36.287Z
JVApen
<p>I have noticed that in many <em>computer science</em> courses, professors tend to focus on teaching <code>C++11</code> as the primary version of the <code>C++</code> programming language, rather than covering newer versions such as <code>C++14</code>, <code>C++17</code>, or <code>C++20</code>. I'm curious about the reasons behind this approach and whether it's common across different academic institutions.</p>
<p>I took plenty <code>C++</code> courses at &quot;my&quot; (I don't own it...) university including <strong>OOP</strong>, <strong>Data Structures</strong>, <strong>Algorithms and Analysis of them</strong>,... and they always wanted us to compile the code with specific flags (Most of them don't matter, like <code>-Wall</code> or <code>-Werror</code>) such as <code>-std=c++11</code>. I never really noticed that in the lower level courses, but as you move up you start to notice some things aren't available in <code>C++11</code>, and those might be the solution to your problem.</p>
<p>Specifically, I would like to know:</p>
<blockquote>
<p>What are the main factors that influence professors' decisions to teach C++11 over newer versions?</p>
</blockquote>
<blockquote>
<p>Are there any significant differences or challenges associated with teaching newer versions of C++ in a classroom setting?</p>
</blockquote>
<blockquote>
<p>How does this choice impact students' learning experiences and their preparedness for industry standards?</p>
</blockquote>
<blockquote>
<p>Are there any educational resources or case studies available that discuss the benefits and drawbacks of teaching different versions of C++?</p>
</blockquote>
<p>I appreciate any insights or experiences shared by educators, professionals, or students who have encountered this teaching approach in computer science programs. Additionally, if there are alternative teaching strategies that incorporate more recent <code>C++</code> versions, I would be interested to learn about those as well. Thank you!</p>
<p>P.S I'm sorry is I offended anyone by including <em>(all)</em> in the question title.</p>

CC BY-SA 4.0
2023-05-26T07:31:19.813Z
The bleeding edge can cause some... well you know... bleeding!! More seriously: thanks for letting me know that 11 is the common choice. To me it's almost axiomatic that jumping at the latest is likely a bad idea. [If I've a choice I prefer teaching with python 2 over 3]
Rushi
CC BY-SA 4.0
2023-05-26T08:56:32.850Z
Something i noticed while teaching, is that teachers often don't catch up with what they teach.  So they only teach what they learned themselves in college.
A.bakker
CC BY-SA 4.0
2023-05-26T15:42:36.763Z
I must say I have had some pretty "uncomfortable" experiences on SO in particular, where I would post a good question and most of the responses would be "*just use this... or just use and STL container, and so on*" I understand that due to learning purposes professors tend not to use the STL since, well everyone can google the documentation...
I_throw_but_dont_catch
CC BY-SA 4.0
2023-05-26T15:46:20.027Z
But what strikes me as shocking is the number of times I saw comments like "*This is the Java way of C++ programming*" referring to the `new` keyword. My professor in my Data Structures class was in the industry for 17 years and I genuinely thought she was a great professor, but yeah as you mentioned some professors don't catch up on the material...Apparently, she never worked with C++ since she did front-end dev.
I_throw_but_dont_catch
CC BY-SA 4.0
2023-05-27T12:00:06.557Z
The same answer for `11` as for `C`: out of touch, been told to by people that are out of touch. C is not a good teaching language, and has not been a good production language for most cases for years. Now we have `rust` and `go`, it may not be the best for anything.
ctrl-alt-delor
CC BY-SA 4.0
2023-05-27T16:54:35.587Z
I understand why `C++` would be the preferred language to start with (pointers, manual allocation, OOP,...), and transitioning to another language such as `Python` or `JS` might be easier. But why not teach the latest version?
I_throw_but_dont_catch
CC BY-SA 4.0
2023-05-27T19:47:13.763Z
Can you please clarify what feature(s) you believe would significantly help with explaining concepts of programming (like "sorting algorithms and complexity" or "recursion and memoization"). You can start with lists like https://en.cppreference.com/w/cpp/20 to pick some that would help every single student with that.
Alexei Levenkov
CC BY-SA 4.0
2023-05-27T20:07:26.533Z
I know the use of `STL` is discouraged due to learning purposes, but here are some I find useful [`std::atomic_ref`](https://en.cppreference.com/w/cpp/atomic/atomic_ref), [`std::unordered_map`](https://en.cppreference.com/w/cpp/container/unordered_map)(`erase_if` and new operators), [`std::span`](https://en.cppreference.com/w/cpp/container/span), [three-way operator](https://devblogs.microsoft.com/oldnewthing/20220516-52/?p=106661#:~:text=The%20C%2B%2B20%20three,equivalent%2C%20greater%2C%20and%20unordered.), [self-explanatory](https://en.cppreference.com/w/cpp/ranges)
I_throw_but_dont_catch
CC BY-SA 4.0
2023-11-08T19:25:32.443Z
I teach C++20 (I will start teaching C++23 as soon as all major compilers start supporting all the major features of it) with CMake as the (meta) build system. This is not the first programming course for my students. It's either 2nd or 3rd. Since we mainly teach Java, I chose to teach C++20 focusing on features that are relevant to broadly classified "business solutions". It not only enables me to use new, cool features to introduce C++ and then go a little lower in levels of abstractions, but it also reinforces students' understanding of higher level concepts present in languages like Java.
Fureeish
<language-choice><c++><classroom-environment>
Why do (all) professors teach C++ 11?
# Why do (all) professors teach C++ 11?

(Asked by: username_0 on 2023-05-26)

I have noticed that in many *computer science* courses, professors tend to focus on teaching `C++11` as the primary version of the `C++` programming language, rather than covering newer versions such as `C++14`, `C++17`, or `C++20`. I'm curious about the reasons behind this approach and whether it's common across different academic institutions.

I took plenty `C++` courses at "my" (I don't own it...) university including **OOP**, **Data Structures**, **Algorithms and Analysis of them**,... and they always wanted us to compile the code with specific flags (Most of them don't matter, like `-Wall` or `-Werror`) such as `-std=c++11`. I never really noticed that in the lower level courses, but as you move up you start to notice some things aren't available in `C++11`, and those might be the solution to your problem.

Specifically, I would like to know:

> What are the main factors that influence professors' decisions to teach C++11 over newer versions?

> Are there any significant differences or challenges associated with teaching newer versions of C++ in a classroom setting?

> How does this choice impact students' learning experiences and their preparedness for industry standards?

> Are there any educational resources or case studies available that discuss the benefits and drawbacks of teaching different versions of C++?

I appreciate any insights or experiences shared by educators, professionals, or students who have encountered this teaching approach in computer science programs. Additionally, if there are alternative teaching strategies that incorporate more recent `C++` versions, I would be interested to learn about those as well. Thank you!

P.S I'm sorry is I offended anyone by including *(all)* in the question title.

**Tags:** language-choice, c++, classroom-environment

> **Comments:**
> **username_1**: The bleeding edge can cause some... well you know... bleeding!! More seriously: thanks for letting me know that 11 is the common choice. To me it's almost axiomatic that jumping at the latest is likely a bad idea. [If I've a choice I prefer teaching with python 2 over 3]  
> **username_2**: Something i noticed while teaching, is that teachers often don't catch up with what they teach.  So they only teach what they learned themselves in college.  
> **username_0**: I must say I have had some pretty "uncomfortable" experiences on SO in particular, where I would post a good question and most of the responses would be "*just use this... or just use and STL container, and so on*" I understand that due to learning purposes professors tend not to use the STL since, well everyone can google the documentation...  
> **username_0**: But what strikes me as shocking is the number of times I saw comments like "*This is the Java way of C++ programming*" referring to the `new` keyword. My professor in my Data Structures class was in the industry for 17 years and I genuinely thought she was a great professor, but yeah as you mentioned some professors don't catch up on the material...Apparently, she never worked with C++ since she did front-end dev.  
> **username_3**: The same answer for `11` as for `C`: out of touch, been told to by people that are out of touch. C is not a good teaching language, and has not been a good production language for most cases for years. Now we have `rust` and `go`, it may not be the best for anything.  
> **username_0**: I understand why `C++` would be the preferred language to start with (pointers, manual allocation, OOP,...), and transitioning to another language such as `Python` or `JS` might be easier. But why not teach the latest version?  
> **username_4**: Can you please clarify what feature(s) you believe would significantly help with explaining concepts of programming (like "sorting algorithms and complexity" or "recursion and memoization"). You can start with lists like https://en.cppreference.com/w/cpp/20 to pick some that would help every single student with that.  
> **username_0**: I know the use of `STL` is discouraged due to learning purposes, but here are some I find useful [`std::atomic_ref`](https://en.cppreference.com/w/cpp/atomic/atomic_ref), [`std::unordered_map`](https://en.cppreference.com/w/cpp/container/unordered_map)(`erase_if` and new operators), [`std::span`](https://en.cppreference.com/w/cpp/container/span), [three-way operator](https://devblogs.microsoft.com/oldnewthing/20220516-52/?p=106661#:~:text=The%20C%2B%2B20%20three,equivalent%2C%20greater%2C%20and%20unordered.), [self-explanatory](https://en.cppreference.com/w/cpp/ranges)  
> **username_5**: I teach C++20 (I will start teaching C++23 as soon as all major compilers start supporting all the major features of it) with CMake as the (meta) build system. This is not the first programming course for my students. It's either 2nd or 3rd. Since we mainly teach Java, I chose to teach C++20 focusing on features that are relevant to broadly classified "business solutions". It not only enables me to use new, cool features to introduce C++ and then go a little lower in levels of abstractions, but it also reinforces students' understanding of higher level concepts present in languages like Java.  

---

## 4 answers

### Answer by username_6 on 2023-05-29. Score: 7 | Accepted answer

As a professor who teaches C++17/20(/23: `mdspan` for scientific computing): the 11 standard was the big evolution, and 14/17 are only minor improvements over it. If you learn C++11 lambdas, it's unlikely you need the 14/17 improvements in your first, maybe even second, semester of coding.

So I'd consider the `-std=c++11` flag as a minimum for modern C++, as opposed to your grandparent's C++.

That said, I like `std::optional` and structured bindings, and I teach those. This fall will be the first time I include `std::ranges` which I think is fairly elegant. Wish me luck :-)

<https://theartofhpc.com/isp.html>

> **Comments:**
> **username_0**: Thanks, and of course good luck!  

---

### Answer by username_7 on 2023-05-28. Score: 9

The advantage of C++ for teaching programming is that it is *reasonably* close to the actual raw workings of the computer whilst being high level *enough* to teach higher level concepts. The features added in recent versions of C++ are mostly features designed to *avoid* working with lower level workings so using these features detracts from the pedagogical advantages of C++.

There's also probably some aspect that CS Professors are not necessarily interested in keeping up with the bleeding edge of C++ language design and fashion. These are not relevant to the kind of things that most Computer Scientists are doing. Many departments agree which language to use for base courses at the departmental level and these discussions and any changes can be highly political. This is a considerably obstacle to change.

How well it prepares you for industry depends on where you end up, there are plenty of C++ jobs out there with companies that don't use modern C++ features (the last one I had was using C++14, and used their own libraries rather than STL for most everything). But in any case, fresh graduates are expected to need six to twelve months to become properly productive in the workplace anyway, so it's not a particularly big deal whether or not you've learnt some corner of the STL.


---

### Answer by username_8 on 2023-05-29. Score: 5

In regards to "How does this choice impact students' [...] preparedness for industry standards?", as a software engineer working in industry (now retired), I would not expect a negative impact based on my experience. Side remark: The use of `-Wall -Werror` is an industry best practice.

Having worked in a number of Silicon Valley companies I observe that industry is often slow in utilizing new language features for production code, for practical reasons. New language features may be used in research or exploratory code by a small subset of the company's engineers.

The availability of new language features is tied to newer toolchain versions, and most companies value toolchain stability in their development work. It is not out of the ordinary to find a company having standardized on a five year old toolchain, for example because newer versions have been found to contain functional bugs or introduce performance regressions in the company's money-making products. This conservative approach can also be seen in the choice of default compiler offered on various Linux distros, where enterprise level RHEL 8 might ship with gcc 8.x, while at the same time Ubuntu 22 (possibly preferred by researchers and hobbyists) might ship with gcc 11.x.

It is also the case that, for a variety of reasons, different toolchains adopt support for new language standards at different speeds. See the [compiler support matrix](https://en.cppreference.com/w/cpp/compiler_support) at the CPP Reference website for example. This comes into play when a product needs to be supported across multiple platforms, some of which may not be known yet. In that case it makes sense to restrict oneself to the use of a minimum language standard that is supported "everywhere". From what I can see, at the moment that would still seem to be C++11.

> **Comments:**
> **username_6**: `-Wall -Werror`: I tried the other if my codes were clean in that respect. What?! `for ( int i=0; i<myarray.size(); i++)` is not allowed? Fiddle that shirt! Do I seriously have to burden my poor students with the distinction between signed/unsigned 32/64 bit? Ok, you said "industry", but see what forum we are here.  
> **username_8**: @VictorEijkhout I am well aware that this is CSE. I specifically *only* addressed the part of the question dealing with "industry standards" and stated so up front.  
> **username_0**: @VictorEijkhout Unfortunately, yes. At least I was taught about signedness and the bit size of integers (how they're stored in memory, and so on). I really like your attitude toward your students, you seem like a great professor.  
> **username_6**: @TheCompile-TimeComedian My teaching is "operational": anything my students learn needs to be reinforced with a concrete use case. 1. 32 vs 64 bit ints: I have the hardest time getting them to realize that 10k is not a large number. I don't think int overflow happens much in the first semester coding exercises I give them. 2. signed/unsigned: even more rare to run into. I save 2's complement and IEEE 754 for a more advanced class. So I'm afraid that teaching them `for ( size_t i=....` this will become voodoo programming: just a magic formula they have learned, without understand the why of it.  

---

### Answer by username_9 on 2023-11-04. Score: 3

I'm no teacher, though following the community online I have the impression that too many students are exposed to C++98/03, pre-standard C++ or C in their C++ courses. If they all would be making the jump to C++11, we would give them a better experience.

Personally, I don't see much difference between C++11 and C++17 while the latter provides quite some quality-of-life improvements.

An argument I've heard before was that universities teach what the industry uses. Following that reasoning I would not expect C++20, however C++17 should follow that rule.

I also believe that we, as a community, should make a better stand on what versions our considered outdated. I was glad to see boost drop C++98 requirements, though that's just a first step.

> **Comments:**
> **username_0**: I am still in school right now, and I am taking OOP class in C++, Java and C#. Nobody in that class teaches any industry practices since they differ so much it's basically pointless (use of in-house standards). I personally see some noticable differences between C++11 and 17, like lambdas, compile time eval, threading, and STL.  
> **username_9**: That's what I meant with quality of life improvements. All those things exist in C++11 (except some STL sub libraries) though they became much easier to use. All of them are still the same concepts, so you don't need big reworks of the way you teach them, unlike ranged-for, auto, introduction of lambdas, std::move, std::unique_ptr. All of those where new concepts that really change the way people think about writing code.  

---

