Interview with Bjarne Stroustrup

A discussion about the creation of C++, its strengths and what C++ programmers should remember.

Below, Aleksey Dolya interviews Bjarne Stroustrup, the creator of the C++ programming language.

Linux Journal: How old are you? Do you have family?

Bjarne Stroustrup: I'm 51 years old. I'm married and have two children; both are now university students.

LJ: Bjarne, can you say a few words about your youth? When and where you were born, where you studied?

BS: I was born in Arhus, Denmark. I'm not from an academic family, but I did well in school. So I continued through my local high school and then went on to the University of Arhus, where I received a Masters degree in Mathematics with [a focus on] Computer Science. Arhus is a wonderful town with about 250,000 people situated on the east coast of Jutland. Like most boys then and there, I played in "the yard" of our apartment block, delivered newspapers and milk to get spending money, played soccer, bicycled to the beach in the summer and learned to appreciate the woods near town as a boy scout. Towards the end of my university studies, I became interested in microprogramming and went to England, where they had better machines for that. I eventually ended up getting my PhD from Cambridge.

LJ: And where do you live now?

BS: I live in a suburb of New Jersey called Watchung. It's a small, quiet place with a lot of trees. When you see it from the air in the summer, almost all you see are trees. It is ten-minute drive from Murray Hill, where I used to work at Bell Labs, and about 30 minutes from Florham Park where I work at AT&T Labs. It's about 35 miles from New York City. I used to be able to see the World Trade Center towers from just around the corner by my house.

LJ: This points to a file with the proper pronunciation of your first name and surname. Are you its author?

BS: Yes, that's me.

LJ: Did you have a computer at home when you were growing up?

BS: No, it was too early for that. Computers were very expensive and lived in university departments and large companies. The first computer I saw was my university's Math department's GIER. It was an old Danish computer that filled a room and was fed programs on paper tape. I learned to program in Algol 60 on that one.

LJ: Every famous man has his beginning. Bill Gates, for example, began by writing his first program in Basic, a program his school had bought. What was your beginning?

BS: I think the key project was a distributed systems simulator that I wrote in Simula67 as part of my PhD work at Cambridge. However, much of what I did during my university years contributed significantly. For example, I financed my Masters degree by writing small commercial programs for the Arhus office of Burroughs, a company that later merged with Univac to create Unisys. There, I learned to develop programs that other people would rely on for their livelihood; that's very different from just getting a program to work for yourself or your friends. I also had to design those programs in consultation with their eventual end-users; that too was very different from simply solving a programming exercise at the university. In addition, my work with machine architecture helped me make decisions about programming languages and implementation techniques.

If you are interested in the personal aspects of the birth of C++, you might consider reading the chapter about me and C++ in Steve Lohr's book Go To: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution (ISBN 0-46-504225-2). For a more technical description of the origins of C++, see my book The Design and Evolution of C++.

LJ: How did you come to invent the C++ language?

BS: After completing my studies at Cambridge in 1979, I went to the US to work as a researcher for AT&T Bell Labs in Murray Hill, New Jersey. There, I started a couple of projects related to distributed computing using local area networks. However, I wasn't making good progress because the available tools were inadequate for those projects. So, I developed something I called C with Classes to allow me to use Simula-style program organization (what is now called object-oriented programming) for simulations and close-to-the-hardware systems programming. C++ was based on C with Classes and what was learned by me and many others (mostly at Bell Labs) by using C with Classes in many application areas.

LJ: Are you proud of your C++ language?

BS: Naturally. I'm very happy with the way it allows me to write programs that are simultaneously elegant and efficient. I'm also quite proud of its widespread use. That said, I don't claim that C++ is perfect. There is a lot of really horrible C++ code out there, because many programmers haven't learned to use C++ well. I encourage people to look at my home pages, papers and books for ideas about how to improve their code. My impression is that most C++ code could have been much cleaner, maintainable and efficient than it is had the designers and programmers understood up-to-date C++ features and techniques. Standard C++ really does make possible programming techniques that were infeasible ten years ago. Unfortunately, many are constrained or feel constrained to use C++ as it stood ten years ago, or they simply use it as a better C.

LJ: How do you feel now, knowing that millions of people work using the tool you created?

BS: I'm very pleased, but as I said, I wish they'd do themselves a favor by using it better.

LJ: Do you think that creating C++ has been the most important thing in your life? Do you think you will do something more useful in the future?

BS: It has certainly been the most significant part of my working life, and it's unlikely that I could produce something that would be more significant. Many of the applications that most directly affect our daily lives are C++ programs. To get an idea, see my short list of C++ applications.

I'm sure I'll do something significant and useful in the future. It's just unlikely that I'll create something of the magnitude of C++. I have recently decided to go into academia and accepted a professorship at Texas A&M University. There, I will be able to combine research with teaching in a way I can't at AT&T Research. I see teaching as another and different way of influencing the world for the better, and academic research provides somewhat different tradeoffs from the industrial research that I have practiced so far--not better, just different. I will keep ties to AT&T Research and to industry in general, because much of the best research is rooted in problems found in industry.

LJ: Do you use C++ in your work?

BS: Yes. It's my main research tool.

LJ: What C++ compiler is the best from your point of view?

BS: The major C++ implementations now are all pretty good or better. By that, I mean they are close to the ISO C++ standard and provide good run-time performance. For a list, see www.research.att.com/~bs/compilers.html. I don't recommend compilers that have fallen way behind the standard, such as (sadly) Watcom.

LJ: What compiler do you use at work?

BS: Several; for the moment, GNU, Microsoft, Borland, SGI and Metrowerks.

LJ:If it's not a secret, what do you research at your job?

BS: I'm looking at ways of doing distributed computing, trying to apply some program transformation techniques to allow me to use standard C++ source code for a variety of distribution architectures.

I suspect that this research is better for a technical paper or technical talk than for an interview, but I can give an example. I wanted to write a small program than needed to run with parts being on several computers. Conventionally, I'd have to write that program so the communication methods were explicit in the program. For example, if I used CORBA, my code would contain CORBA calls and I'd need to write IDL for the types I wanted to communicate between the parts of my program. If, on the other hand, I wanted the communication to use TCP/IP directly, my code would be full of TCP/IP library calls. Instead, I wrote a program where the communication between the parts were represented by ordinary C++ member function calls. If the object to be called was local, I directly called members of class X; if not, I called the same members of class proxy<X>. Using a library with facilities for C++ program transformation, I then automatically converted the calls of proxy<X> into message sent across a TCP/IP connection or, alternatively, to CORBA calls.

LJ:Did any companies other than AT&T Bell Labs try to make you their employee?

BS: Certainly; several companies and universities did, but until this year they all failed.

LJ: What is your favorite OS?

BS: I use Unix and Windows2000.

LJ: What Unix?

BS: Currently, Solaris, Irix and Linux. I try not to depend on features that are not standard across systems.

LJ: Do you think they are the best OSes available today?

BS: They are good OSes, but I'm not sure what would make an operating system the "best" in general. There are serious tradeoffs among factors such as size, performance (of various forms), ability to run existing applications, availability on various hardware and so on, so that users still have to choose among good systems for one that is best for a given set of applications.

LJ: Which processor do you prefer, Pentium or Athlon?

BS: I don't have a preference, but the 8*86 isn't anyone's favorite machine architecture. The way they use hardware to map from their archaic instruction set to the internal RISC architecture it truly remarkable.

LJ: How much time do you spend working with PCs every day?

BS: I must spend more than eight hours a day with computers, slightly less on weekend days. Not all of my computers are PCs, though.

LJ: Does your heavy PC work on a daily basis cause any health problems?

BS: I occasionally get a sore right arm from using a mouse too much, and less frequently I get a sore lower back from sitting at a desk too long. I fight this by taking walks and by running. Most weeks, I run four to six miles two or three times a week.

LJ: What computer(s) do you have at home now?

BS: A Sun box running Solaris, my IBM laptop running W2000, a Linux handheld, an old Windows box running W95 and an "antique" Apple Mac. As you can guess, I'm rather keen on portability and a reasonable degree of system independence.

LJ: And at the office?

BS: A Sun and my laptop. From these computers (both at work and at home), I can reach many more systems through the internal AT&T Research Net and beyond. If people are interested, they actually can see those computers and the rest of my office in a panorama accessible from my home page.

LJ: What programming languages do you know?

BS: That depends on what you mean by "know", but I have a working knowledge of a few languages and a reading knowledge of many more. Examples are ML, PERL, Python and Ada.

LJ: What languages do you think are serious competitors to C++?

BS: That depend on the application. Sometime C++ is the best choice; at other times there are reasons to prefer a language such as Fortran, Java, C# or Python. And yet other times, one could use a more experimental language just to learn something new. There are many languages that are good for what they are designed for, and it is a mistake to rely solely on one language. On the other hand, competition is often based on marketing and perceptions rather than facts, and I'm not going to comment on that.

LJ: What do you think about the .NET-platform and its child, the C# language?

BS: I still know too little about .Net to be comfortable writing about it.

LJ: Can C# be a universal language for everything?

BS: No. It's too high level for many kinds of systems programming, too specialized to Windows for many other kinds of programming and proprietary. That, of course, doesn't mean it cannot be a good tool for the middle-of-the-road Windows applications it is designed for.

LJ: But .NET is a platform that can be designed for various OSes. For example, there are some steps available from Microsoft to make that platform for FreeBSD. Do you still think that it's too specialized to Windows?

BS: Let's wait and see how things develop. Currently .Net is a Microsoft proprietary platform for Windows, and I don't expect to see significant use of it elsewhere anytime soon.

LJ: What is your opinion about the abyss between the C and C++ languages? Those two languages seem to be becoming further and further apart from each other.

BS: I think that the current mess of C/C++ incompatibilities is a most unfortunate accident of history, without a fundamental technical or philosophical basis. Ideally the languages should be merged, and I think that a merger is barely technically possible by making convergent changes to both languages. It seems, however, that because there is an unwillingness to make changes it is likely that the languages will continue to drift apart--to the detriment of almost every C and C++ programmer.

LJ: Are you taking any steps to integrate C and C++?

BS: I'm trying to make people see the advantages of C/C++ compatibility for the C/C++ community. In particular, I have written a series of articles for The C/C++ Users Journal on that topic, which you can download from my publications page and the CUJ site. However, there are entrenched interests keeping convergence from happening, and I'm not seeing much interest in actually doing anything from the majority that, in my opinion, would benefit most from compatibility. As ever, the majority just hopes that things somehow will work out for the best.

LJ: Would you say that C++ is the best of the best, compared to other programming languages?

BS: No; that wouldn't be meaningful. There are many great programming language. C++ is one of them, but there is not and could not be a single language that is the best for every person and every problem.

LJ: Do you have any programming certificates?

BS: No. In general, I value education over training and would almost always choose someone with a broad and deep general knowledge over someone with only specific training. A combination of academic and practical skills is my ideal.

LJ: Do you think the certificate system is useful for programmers and organizations that hire programmers?

BS: I don't know of a certificate system that is really valuable for programmers. I prefer traditional degrees from universities, engineering schools, etc.

LJ: What is your opinion, is knowing assembly language useful for programmers nowadays?

BS: It is useful to understand how machines work and knowing assembler is almost essential for that. If you don't know the machine at that level, you almost certainly suffer from serious misconceptions about computers, and some parts of the system are magical to you. Currently, I'm reading the latest edition of Hennesey & Patterson to bring my knowledge of machine architecture up to date.

LJ: "Last edition of Hennesey & Patterson". What is it?

BS: Probably the best book explaining modern computer architecture. This is a book you want to read if you want to know what's really going on inside your processor. It's not bedside reading, though, at about 1,000 pages long.

LJ: Do employers need asm-programmers?

BS: Not as such, but programmers who work with DSPs at the basic level must know the architecture of their processors very well.

LJ: What is DSP?

BS: DSP is digital signal processor. The relevance of my comment is that DSP instruction sets have more special cases that ordinary general-purpose processors, and compilers are relatively less capable of generating good code for DSPs.

LJ: Is it true that programmers who understands OSes on the kernel level can get more money (30-40%) than common high level programmers?

BS: I don't know; I don't keep statistics on salaries. Knowledge of kernels is useful, so it ought to be valuable, but so are many other kinds of knowledge.

LJ: Do you play computer games?

BS: Hardly ever any more. Unfortunately, I don't have the time.

LJ: What is your favorite meal?

BS: I don't think I have a favorite meal as such. Just about any meal in congenial company is a feast. However, there's a Danish meal called a cold table that starts with several kinds of herring, moves on to fish and meat and usually ends with shellfish and cheese. Traditionally, a cold table is accompanied by beer and aquavit. My wife has an excellent recipe for pork tenderloin with watercress salad, and my favorite Italian restaurant serves a spectacular Zupetta de Peche, which is fish and shellfish over linguini with a spicy ("Fra Diavolo") sauce. Yum!

LJ: Are happy now?

BS: I'm reasonably happy, as I ought to be given my family, my friends, my contributions to programming, my career and so on.

LJ: What would you like to say to programmers who use C++ or on their way to doing so?

BS: Be adventurous in your experimentation and somewhat more cautious in your production code. On my home pages, I have a "Technical and Style FAQ" that gives many practical hints and examples. However, to really develop significant new skills, one must read articles and books. I think of C++ as a multi-paradigm programming language. That is, C++ is a language that supports several effective programming techniques, where the best solution to a real-world programming problem often involves a combination of these techniques. Thus, I encourage people to learn data abstraction (roughly, programming using abstract classes), object-oriented programming (roughly, programming using class hierarchies) and generic programming (roughly, programming using templates). Furthermore, I encourage people to look for combinations of these techniques rather than becoming fanatical about one of these paradigms because it happens to be a great solution to a few problems.

It is important to remember that a programming language is only a tool. Once you master the basic concepts of a language, such as C++, it is far more important to gain a good understanding of an application area and of the problem you are trying to solve than it is to study the minute technical details of C++. Good luck, and have fun with C++!

Aleksey Dolya is a Russian C/C++ programmer interested in network security and software protection.

______________________

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Re: C++ should never been

Anonymous's picture

Hey, don't talk about the kernel! It is even imposible to write variable-sized arrays in Java without using native methods!
It is impossible to implement the java.* entirely in Java. Compare this with Standard C++ Library.

Re: C++ should never been

Anonymous's picture

Umm...

ArrayList al = new ArrayList();

al.add(obj); // do this sort of thing to your hearts content.

Not unlike the standard c++ lib's IRC.

There's no reason you couldn't write a "kernel" in java.
A J2EE container is effectively a kernel. But of course
the type of kernel you guys are talking about would
be stupid to do. JavaKernel runs on a JVM which is written
in C and runs on the OS.

Re: C++ should never been

Anonymous's picture

C++ code is unportable, and difficult to debug
Incorrect, and misleading. What language is easy to debug?
an overly rich feature set and syntax - this has lead to enormously bad C++ code
Probably correct.
Java, although imperfect, is really "the better C".
This statement is absurd. Java and C, despite syntactic similarities, are not even intended to solve the same sets of problems.
Bjarne, if he had been a little bit more clever, would never have created C++ in the first place.
C++ articles always bring out the saddest little trolls...

Re: C++ should never been

Anonymous's picture

"C++ is an inglorious hack, and as such it has cost the software development world a huge amount of time."

No, many people have worked years and thought too much about the implementation for it to be a hack.

"C++ code is unportable."

No, the library "ACE" has shown that C++ can be more portable than Java. I suggest looking to how many platforms it has been ported too.

"..and difficult to debug."

Compared too what? In my experience what makes its no harder to debug C++ than Java.

"It is an overwrought language that has an overly rich feature set and syntax - this has lead to enormously bad C++ code (and coding habits) throughout the world."

That can be said of Java, as of 1.5 and many other languages. What you seem to be hitting on is that the language provides many options, and it does take a long time to come to grips with them and understand how to apply them. No langauge can make up for lazy programmers; not thinking through the solution; not concidering all aspects of the problem you are solving with the code you are writing is the major source of troubles. No language can solve that problem.

C++ does provide many tools for constructing programs that are very maintainable. Some of these tools, like templates, are more developed in C++ than any other language I know of. This leads to capabilities that are hard to equal. It leads to the ability to encapsulate and reuse code not equaled in other langauge I've worked with. This leads to decreased development costs and time. But you must understand the features and the problem you are solving - as is always the case in any programming situation.

Re: C++ should never been

Anonymous's picture

Wake up.

  • If you write unportable C++ code, that's your fault, not the language's.
  • You don't have to use every feature in a language. If you're using some programming language's features just to create more interresting source code, you're bound to get burned. This is not C++ specific.
  • If Java is a "better C", then please write a JVM in Java.

Re: C++ should never been

Anonymous's picture

What do you mean by write a JVM in Java.

If you mean the compiler, it is written in Java. You can compile our code on the fly inside the JVM. Just have a look at tools.jar ;) Since ultimately it has to be converted to the relevant machine code nobody really does it. But yes it is possible if someone really wanted to do it.

Just build a Java to native compiler :) like GCJ.

Critising Java the language is different from Java the platform. C++ is a language so you should compare with Java the language. You could definitely use Java the language to build a JVM.

Re: C++ should never been

Anonymous's picture

Java, although imperfect, is really "the better C".

Eh? C is "portable assembly", and C++ has similarly direct mapping between the presentation and the object code (i.e. you can guess pretty well what kind of machine code a snippet of source produces). Java is not even close, it's a language for different problem domain.

-- Ville

Re: C++ should never been

Anonymous's picture

100% ACK. I have to work everyday with this language since ~5 years and all i have to say: it is a mess, it tries to do everything, is hard to debug, leaves too much room for human errors (most common errors in programming) - a good language should prevent them and not support them, it is hard to learn (making maintanance harder) - i needed around two years to learn all language features (maybe i still don't know 100% of the language). poor portability - compared to C. AFAIK only 1! compiler which supports 100% of the latest C++ standard.

Yes, C++ has his advantages (like all languages - except VB ;-) ) like the incredible powerfull template mechanism, is very scalable (both: low-level and high-level programming), OOP AND structured programming. Yes this monster is powerfull, maybe too powerfull...
I see C++ primal area of application where language scalability and performance is important like games and applications for embedded systems.

People seem not very pragmatic about language choice today - language choice seems quite irrational these days. I incline to go the way of DSLs (Domain Specific Languages) - use the best suited language for the job. My preferred mixture is Python for high level stuff and C for low-level/"rapid" code.

Re: C++ should never been

Anonymous's picture

Well buddy I don't have much to say. You seems ain't know a thing about C++. Next time learn first then comment !!!

-sakkraya

Re: C++ should never been

Anonymous's picture

I also have used C++ to a large extent, and on the whole agree with the post you replied to. I do not know why you assume he knows nothing about C++. Perhaps you are irrational?

Re: C++ should never been

Anonymous's picture

I started learning programming in 1972. (COBOL - yuch!) People have always been irrational about language choice.

Re: C++ should never been

Anonymous's picture

The good thing of C++ is that it remained in the middle of the road towards
a full OO language. The bad thing is that it remained in the middle of the road towards a full OO language. As Bjarne said, the problem is who seats in front
of the keyboard. So much code is poorly written C code within a C++ appearance, full of pointers, C mallocs() and so on. The problem is
that C++ does not discourage thta kind of habits.
Surely Java is more clean language, by this point of view.
Someone says Python is not a true OO lanuguage because it does not enforce hiding, too. Anyway I use C, Python, Java, Perl, PHP and shell scripting when ever I need each of them. And also C++ if required :)

Re: C++ should never been

Anonymous's picture

What is true OO, that it must include data hiding?

Re: C++ should never been

Anonymous's picture

Amen.

I worked on a project which we're porting from C++ to Java. In C++, the bulk of the code used char *s (which have to be copied, or just leak). I replaced some of this with std::strings, but there's a lot of it.

In Java, of course, we just use the standard String type, and all else that comes with the language.

I think people feel that in C++ they have to get every ounce of performance out of the language, and eventually they'll realise how unnecessary this is. However, it might be noted that you do need to use pointers in order to get inheritance, and then you lose 'easy' storage management. So no language is perfect in that respect.

Re: C++ should never been

feynman's picture

I seriously doubt that you have ever programmed in your life. You don't even seem to knowing what programming is.

Java is a language for the those who want a quick fix to a problem and don't bother if it is a bad one. It makes life easy for non-programmers like you who want to do programming but don't know how to do it.

C++ provides elegant solutions to complex problems and it's for those who love programming. C++ rules.... Kudos to Bjarne.

Re: C++ should never been

Anonymous's picture

Great work Bjarne! Without this tool, a lot that has happened wouldn't have happened in the progamming arena. As I use the tool, i discover new things and many will agree that this is a VERY POWERFUL tool! I wish people may start looking on the bright side of this Language.

Those who love programming?

Anonymous's picture

Java is a language for the those who want a quick fix to a problem and don't bother if it is a bad one. It makes life easy for non-programmers like you who want to do programming but don't know how to do it.

I'm no Java fanatic, but it really seems like you haven't even used Java, because if you had, you'd know that Java is never a quick fix for anything. However, Java is just a better programming language than C++ for a pretty large problem domain - it's more manageable for the average developer, opportunities for reuse are clearer because you can actually concentrate on higher level issues than where your memory is going (or reinventing the garbage collection wheel).

Very few developers are writing operating system kernels, and most developers who do need performance-related benefits from C++ could do themselves a favour and learn other languages which could easily take the place of C++ in large sections of development projects.

C++ provides elegant solutions to complex problems and it's for those who love programming.

Hilarious! You mean "if you love dicking around with tedious details that were once interesting when you wanted a frivolous intellectual challenge". If you really "love programming" and C++ represents your "love-in" zenith then if you ever try higher level languages than C++, I'm convinced that you'll have to lie down for a while. Unless you get off on those frivolous intellectual challenges...

Re: C++ should never been

Anonymous's picture

C++ was created. But it was ultimately people who adopted it. It was never pushed down anyone's throats. It was used for a reason. People liked what they saw and it fulfilled a need. Java needed much more powerful hardware before it could ever become viable.

Choice is good. Don't go around blaming Stroustroup for what he created, You are free to create whatever you want. Just as people are free to adopt whatever they want.

Re: C++ should never been

Anonymous's picture

You area a troll. C++ Rules!! You would know this if you had a brain. Let me guess? You are in marketing and have never writring a single line of production code.

White Paper
Linux Management with Red Hat Satellite: Measuring Business Impact and ROI

Linux has become a key foundation for supporting today's rapidly growing IT environments. Linux is being used to deploy business applications and databases, trading on its reputation as a low-cost operating environment. For many IT organizations, Linux is a mainstay for deploying Web servers and has evolved from handling basic file, print, and utility workloads to running mission-critical applications and databases, physically, virtually, and in the cloud. As Linux grows in importance in terms of value to the business, managing Linux environments to high standards of service quality — availability, security, and performance — becomes an essential requirement for business success.

Learn More

Sponsored by Red Hat

White Paper
Private PaaS for the Agile Enterprise

If you already use virtualized infrastructure, you are well on your way to leveraging the power of the cloud. Virtualization offers the promise of limitless resources, but how do you manage that scalability when your DevOps team doesn’t scale? In today’s hypercompetitive markets, fast results can make a difference between leading the pack vs. obsolescence. Organizations need more benefits from cloud computing than just raw resources. They need agility, flexibility, convenience, ROI, and control.

Stackato private Platform-as-a-Service technology from ActiveState extends your private cloud infrastructure by creating a private PaaS to provide on-demand availability, flexibility, control, and ultimately, faster time-to-market for your enterprise.

Learn More

Sponsored by ActiveState