Initialization in C++ is Seriously Bonkers
In my view this author falls into the camp of people calling C++ a mess because it gives them too much control when they ask for it. One of his examples which he calls "The Abyss":<p><pre><code>    #include <iostream>
    struct A {
        A(std::initializer_list<int> l) : i(2) {}
        A(int i = 1) : i(i) {}
        int i;
    };
    int main() {
        A a1;
        A a2{};
        A a3(3);
        A a4 = {5};
        A a5{4, 3, 2};
        std::cout << a1.i << " "
                  << a2.i << " "
                  << a3.i << " "
                  << a4.i << " "
                  << a5.i << std::endl;
    }
    </code></pre>
which outputs:<p><pre><code>    1 1 3 2 2
</code></pre>
he claims to be mysterious but is actually pretty reasonable.<p>In the case of:<p>a1: There is no initializer list in the variable declaration, so ctor 2 is called.<p>a2: An empty initializer list should reasonably behave like a default constructor, and a default constructor should be more efficient than processing an initializer_list, so ctor 2 is called. In general, the constructor with the matching number of arguments and correct types is preferred over initializer_list constructors. Makes sense, being able to specialize on number and type of arguments is more powerful than a design where a single initializer_list ctor invalidates all other ctors.<p>a3: No list, ctor 2 is called.<p>a4: Non-empty init list and no specialized non-init-list ctor, so ctor 1 is called.<p>a5: Several-variable init list and no overriding 3-variable constructor with matching types, therefore ctor 1 is called.<p>Complex? Maybe, but that's what you get with C++: very fine control of program semantics, benefit being expressive libraries. No other language fills this niche that I'm aware of.<p>I agree that C++ isn't a good language to teach in a CS 101 class. But no other single language is good either. The goal of CS 101 is to not make students give up before they get hooked, and that can happen because the material is too challenging or not challenging enough. For people in the former category, give them a scripting language and visual feedback, like Lua + Garrysmod. For the latter, give them assembly, haskell, C, C++ (teaching it like "C with templates" not "C with classes").