5

I heard from a friend that Bjarne Stroustroup admitted that he doesn't know entirely the C++ programming language due to its vast complexity

Is it true and there's some referrable sources or is it just an exaggeration?

This affirmation should be present on his website, he told it in an interview/conference some time ago

10
  • 18
    @hyde: Knowing the keywords of any language tells us exactly nothing... Mar 23, 2013 at 10:12
  • 1
    @thorstenmüller Reciting all reserved words of a language from memory was an exxageration and irrelevant I admit, and you probably refer to that. But recognizing them in code and knowing what they do in any given context... Well, if someone does know the keywords, they can tell what code does, and if not, at best they can make an educated guess of what the code may do.
    – hyde
    Mar 23, 2013 at 10:37
  • 1
    Even if he didn't, he should have said that.
    – SChepurin
    Mar 23, 2013 at 11:47
  • 9
    true.. Einstein said "[I do not] carry such information in my mind since it is readily available in books".. so those saying memorising everything is the only way to know something are suggesting Albert was a bit of a thicky :-)
    – gbjbaanb
    Mar 23, 2013 at 14:58
  • 5
    @hyde: it's easy to recognized reserved words. They show up in different color :)
    – DXM
    Mar 23, 2013 at 17:19

6 Answers 6

17

In a comment to your original question, I mentioned that I'd seen something similar, but I couldn't find it. Well, I found what I was thinking about.

From Stroupstrup's "interviews" page, there is a link to a PDF ("Interview by Ryou Ezoe")

Page 9 of the PDF has the quote I'd remembered. It reads as follows (Stroustrup speaking):

Even I can’t answer every question about C++ without reference to supporting material (e.g. my own books, online documentation, or the standard). I’m sure that if I tried to keep all of that information in my head, I’d become a worse programmer. What I do have is a far less detailed – arguably higher level – model of C++ in my head.

So, if nothing else, I found what I'd been looking for. Your question forced me to do it. Thank you.

4
  • 1
    Thank you Radian, I'm sure my friend meant the link you found. It has been nice that so many discussions arose from my question!
    – John Smith
    Mar 24, 2013 at 3:32
  • 1
    And thank you for taking the time to find this and satisfy my curiosity! That was priceless! Thank you!
    – John Smith
    Mar 24, 2013 at 3:35
  • So basically mastering all of C++ makes you a worse programmer as stated by the inventor of C++.
    – Brian Yeh
    Dec 2, 2020 at 7:46
  • @BrianYeh - seems to be what he is saying.
    – Radian
    Dec 3, 2020 at 18:07
17

I don't know if Stroustrup ever said anything like that. I've never heard that.

I did once attend a lecture by Brian Kernighan in 1992 or thereabouts where Kernighan pointed out humorously that he routinely wrote programs that used every feature of C and had never even come close to writing a program that used all the features of C++, but his point was not that C++ was unknowable; rather, that the language had added a lot of special-purpose features.

More generally: it is very difficult to keep all of a large, complex language in your head at once. If a language has n non-orthogonal features then there are O(n2) interactions between those features.

2
  • "the language had added a lot of special-purpose features": besides that, when you have different ways of doing things, you eventually pick one and keep using that one. It is quite common to start using a subset of a language if the language offers alternative ways of solving the same problem.
    – Giorgio
    Mar 23, 2013 at 15:48
  • 4
    Even Kernighan is likely exaggerating. I very much doubt Kernighan ever routinely wrote programs in C that included the unary plus operator, the auto keyword, setjmp.h, or all of the facilities in stdarg.h and the corresponding v*printf functions. Mar 23, 2013 at 17:55
13

is it just an exaggeration? ...this affirmation should be present on his website

It's just an exaggeration and you are right, affirmation of that is present on his website, right in the FAQ page. Stroustrup's position on C++ complexity is clearly stated in FAQ -> Why is C++ so BIG?

Full quote of this section is presented below for your convenience, I put bold font on the part of text that directly addresses your question (Stroustrup does not think C++ is vastly complex):

C++ isn't as big as some people imagine. It's not a tiny language designed to be a minimal language for teaching, but neither are the languages people most often compare it to, such as C, Java, C#. They too are huge compared to say, Pascal as Dr. Wirth originally defined it - for good reasons, I think. The programming world is far more complex today than it was 30 years ago, and modern programming languages reflect that.

The C++ standard is 740 pages, but that includes 400 pages of library description. The language features are described (in excruciating detail) in 340 pages. Similarly, TC++PL is 1000+ pages, but only 350 of those are devoted to the explanation of language facilities and their use; the rest discuss libraries, programming techniques, etc.

C++ directly supports (i.e., in the language) what some other languages support through libraries, so the language part will be relatively larger. On the other hand, if you want to write a "typical modern application", you need to consider operating system interfaces, GUI, databases, web interfaces, etc. the sum of language features, libraries, and programming conventions and standards that you must become familiar with dwarf the programming language. Here, C++'s size can be an advantage as far as it better supports good libraries.

Finally, the days where a novice programmer can know all of a language are gone, at least for the languages in widespread industrial use. Few people know "all of C" or "all of Java" either and none of those are novices. It follows that nobody should have to apologize for the fact that novices do not know all of C++. What you must do - in any language - is to pick a subset, get working writing code, and gradually learn more of the language, its libraries, and its tools. For my suggestion on how beginners can approach C++, see Programming: Principles and Practice using C++.


The misquote your friend refers to likely originates from that very section quoted above, as a satire on the statement "the days where a novice programmer can know all of a language are gone, at least for the languages in widespread industrial use".

Note that if you just drop the word novice from that quote, you can pretend that "can't know all of the language" applies to Stroustrup himself.

Note though that the way it is really stated (with novice word in it), it suggests that Stroustrup believes to know all of a language and even more, he believes that with sufficient experience (sufficient to stop being novice), anyone can know.

2
  • 2
    Excellent answer! You have inspired me to "re-learn" C++ after many years :)
    – maple_shaft
    Mar 24, 2013 at 1:41
  • Upvoted, this is a great answer!!
    – John Smith
    Mar 24, 2013 at 3:33
7

Since 1998 C++ is an ISO international standard, which basically means it's not just one person redacting it. It's a committee with a lot of people arguing about features to add or things to change (after a proposition have been made ready for review). It also means the details of the language might not be understood fully by all committee members, mainly because C++ standard document is mainly targeted at compiler implementer.

I don't see why it is surprising that the original author can't know all the details.

0
5

Stroustrup writes "The C++ Programming Language", which is described (by the publisher) as "his definitive reference" and "The C++ Programming Language, Fourth Edition, delivers meticulous, richly explained, and integrated coverage of the entire language" (emphasis mine).

It's possible that the publishers are lying, but it's also possible that Stroustrup does understand the whole language, or can research it well enough for his purposes in a given situation. I'm inclined to believe the latter.

5
  • 3
    Having written a book doesn't mean you can remember everything that's in that book. One reason why programmers write documentation is so they can use it themselves when their memories inevitably fail them. I'd bet quite a lot that Stroustrup has to look things up at times, even though it's obvious that he does know C++. There's a big difference between expert and omniscient.
    – user8709
    Mar 23, 2013 at 11:34
  • 4
    @Steve314 "or can research it well enough for his purposes in a given situation".
    – user4051
    Mar 23, 2013 at 11:36
  • It's a great book and also has quite a bit of coverage about how to use the language, rather than merely being a reference for the language features. The third edition explains the language concepts maybe in one third of the book, while second third is devoted for language standard library and it's uses and final third for program design and programming paradigms with all the appendices about language grammar, locales, portability, exception safety and so on. So although especially the fourth edition is going to be big, I expect only part to be for core language and the rest for other stuff.
    – zxcdw
    Mar 23, 2013 at 12:48
  • @Graham - Sorry for forgetting the upvote. On the comment - yes, I was agreeing with and expanding upon that exact point of yours.
    – user8709
    Mar 23, 2013 at 17:05
  • @steve314 I misunderstood your comment then, sorry!
    – user4051
    Mar 23, 2013 at 18:12
4

It's likely an exaggeration, in the same spirit as the fake interview with Stroustrup where he basically "admits" that C++ was designed entirely as a conspiracy to promote programmer job security.

Even if it is true, what does it really mean? What does it mean to "know entirely" a programming language? Does that mean you know every keyword? Does that mean you know every function in the standard library? I've been programming in Python for years now, and I certainly haven't memorized every function in the enormous standard library.

Regardless, claims about the complexity of C++ are often exaggerated or at least, misleading. I regularly program in C++ and Python. When programming in Python I very often have to peruse the docs to find the exact function parameters or whatnot for some function in Python's enormous standard library. In contrast, I barely ever look at any C++ docs, because I pretty much have STL syntax burned into muscle memory, since the C++ standard library is pretty small and generic compared to other languages.

Yes, C++ has many obscure corners like member function pointers, virtual inheritance, pointer-to-data-members, etc. But every language has obscure corners. (Did you know Java has a Void reference type? Have you fully memorized how to work with memoryview objects in Python?) In practice, these features are so rarely used that you'll probably need to open up a reference no matter what if you decide to use them or encounter them in someone's code. But that hardly kills overall productivity, because again, these features are rarely used.

Not the answer you're looking for? Browse other questions tagged or ask your own question.