Modern C++

I’m coming around to two opinions:

  • Modern C++ is one of the greatest programming languages humanity has ever devised
  • Unfortunately, learning it is really hard because every half-assed two-bit tutorial on it insists the world hasn’t changed since 1998

Here’s a brief example from a real web page I found a few minutes ago:

#include <iostream.h>

using namespace std;

void main(void) {
    cout << "Hello world!" << endl;

It’s “teaching” like this that makes me want to reach for a revolver. That code snippet literally predates the C++ standard. It’s not valid C++, it never was valid C++, and no conforming compiler has ever supported it. But since Microsoft Visual C++ 6.0 (a wildly non-conforming compiler) once allowed you to do things this brain-damaged, we’ll never be rid of half-assed “instruction” like this.

The best advice I can give people interested in learning modern C++ is to read Bjarne Stroustrup’s Programming Principles and Practice, which is mostly pretty good. (At the time he wrote it the C++ community thought Concepts was going to make it into the spec, and it didn’t; so, unfortunately, his sidebars on Concepts are, uh, well, not standards-conformant. Yet.)


  1. I’ve been disgusted with that sort of C++ example for a very long time. I understand the reluctance to link to the offending page but it would be interesting to know what/who is responsible and whether that code has been languishing on it since VC++6 was new or if the author still does writes like that.

    • I’m not going to share the page because I suspect it was put together by a teenager who was poorly taught by an instructor who hasn’t kept current with the times. I don’t want to name and shame someone who isn’t responsible for their miseducation. And I also want to encourage teenagers to share the cool things they’ve learned. So for those two reasons, no linkage.

      I strongly suspect the author’s instructor learned VC++6 back in the day, got tenure, and stopped tracking the evolving Standard. That’s what happens in >95% of the C++ classes I’ve seen.

      • I can certainly understand that reason. Hopefully the site have you the ability to leave a correction.

        My daughter has the aptitude to be an excellent programmer but two really bad teachers of the sort you suspect here have pretty much killed her interest in programming. I’m old enough to have gotten into the career self taught before formal schooling was expected. Seeing her experience make me consider myself fortunate.

Leave a Reply