Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×
Programming IT Technology

Ask Bjarne Stroustrup, Inventor of C++ 536

You can learn more about Bjarne Stroutrup here. Even though Bjarne isn't on your nightly news a lot (like never) he deserves (and gets) heavy respect from fellow programmers. If you have a question for Bjarne that he hasn't already answered on his FAQ page, please post it below. If you're a moderator, please moderate others' questions up or down, as deserved, which is just as important as actually asking questions. Tuesday afternoon (U.S. EST) we'll forward 10 selected questions to Bjarne. His answers are scheduled to appear Friday.
This discussion has been archived. No new comments can be posted.

Ask Bjarne Stroustrup, Inventor of C++

Comments Filter:
  • by rambone ( 135825 ) on Monday February 21, 2000 @07:05AM (#1256020)
    What single language (besides C/C++) do you find yourself most productive in?

  • by rambone ( 135825 ) on Monday February 21, 2000 @07:06AM (#1256021)
    Now that the Java hype has cooled off, what is your assessment of its future?
  • Actually, seeing this brings to mind another 'Interview' with Bjarne that I saw a while back....

    Interviewer: Well, it's been a few years since you changed the
    world of software design, how does it feel, looking back?

    Stroustrup: Actually, I was thinking about those days, just before
    you arrived. Do you remember? Everyone was writing 'C'
    and, the trouble was, they were pretty damn good at it..
    Universities got pretty good at teaching it, too. They were
    turning out competent - I stress the word 'competent' -
    graduates at a phenomenal rate. That's what caused the
    problem..

    Interviewer: Problem?

    Stroustrup: Yes, problem. Remember when everyone wrote Cobol?

    Interviewer: Of course, I did too

    Stroustrup: Well, in the beginning, these guys were like
    demi-gods. Their salaries were high, and they were treated
    like royalty..

    Interviewer: Those were the days, eh?

    Stroustrup: Right. So what happened? IBM got sick of it, and
    invested millions in training programmers, till they were a
    dime a dozen..

    Interviewer: That's why I got out. Salaries dropped within a year,
    to the point where being a journalist actually paid better..

    Stroustrup: Exactly. Well, the same happened with 'C' programmers..

    Interviewer: I see, but what's the point?

    Stroustrup: Well, one day, when I was sitting in my office, I
    thought of this little scheme, which would redress the
    balance a little. I thought 'I wonder what would happen, if
    there were a language so complicated, so difficult to learn,
    that nobody would ever be able to swamp the market with
    programmers? Actually, I got some of the ideas from X10,
    you know, X windows. That was such a bitch of a graphics
    system, that it only just ran on those Sun 3/60 things..
    They had all the ingredients for what I wanted. A really
    ridiculously complex syntax, obscure functions, and
    pseudo-OO structure. Even now, nobody writes raw X-windows
    code. Motif is the only way to go if you want to retain
    your sanity..

    Interviewer: You're kidding...?

    Stroustrup: Not a bit of it. In fact, there was another problem..
    Unix was written in 'C', which meant that any 'C' programmer
    could very easily become a systems programmer. Remember
    what a mainframe systems programmer used to earn?

    Interviewer: You bet I do, that's what I used to do..

    Stroustrup: OK, so this new language had to divorce itself from
    Unix, by hiding all the system calls that bound the two
    together so nicely. This would enable guys who only knew
    about DOS to earn a decent living too..

    Interviewer: I don't believe you said that....

    Stroustrup: Well, it's been long enough, now, and I believe most
    people have figured out for themselves that C++ is a waste
    of time but, I must say, it's taken them a lot longer than I
    thought it would..

    Interviewer: So how exactly did you do it?

    Stroustrup: It was only supposed to be a joke, I never thought
    people would take the book seriously. Anyone with half a
    brain can see that object-oriented programming is
    counter-intuitive, illogical and inefficient..

    Interviewer: What?

    Stroustrup: And as for 're-useable code' - when did you ever hear
    of a company re-using its code?

    Interviewer: Well, never, actually, but....

    Stroustrup: There you are then. Mind you, a few tried, in the
    early days. There was this Oregon company - Mentor
    Graphics, I think they were called - really caught a cold
    trying to rewrite everything in C++ in about '90 or '91. I
    felt sorry for them really, but I thought people would learn
    from their mistakes..

    Interviewer: Obviously, they didn't?

    Stroustrup: Not in the slightest. Trouble is, most companies
    hush-up all their major blunders, and explaining a $30
    million loss to the shareholders would have been difficult..
    Give them their due, though, they made it work in the end..

    Interviewer: They did? Well, there you are then, it proves O-O
    works..

    Stroustrup: Well, almost. The executable was so huge, it took
    five minutes to load, on an HP workstation, with 128MB of
    RAM. Then it ran like treacle. Actually, I thought this
    would be a major stumbling-block, and I'd get found out
    within a week, but nobody cared. Sun and HP were only too
    glad to sell enormously powerful boxes, with huge resources
    just to run trivial programs. You know, when we had our
    first C++ compiler, at AT&T, I compiled 'Hello World', and
    couldn't believe the size of the executable. 2.1MB

    Interviewer: What? Well, compilers have come a long way, since
    then..

    Stroustrup: They have? Try it on the latest version of g++ - you
    won't get much change out of half a megabyte. Also, there
    are several quite recent examples for you, from all over the
    world. British Telecom had a major disaster on their hands
    but, luckily, managed to scrap the whole thing and start
    again. They were luckier than Australian Telecom. Now I
    hear that Siemens is building a dinosaur, and getting more
    and more worried as the size of the hardware gets bigger, to
    accommodate the executables. Isn't multiple inheritance a
    joy?

    Interviewer: Yes, but C++ is basically a sound language..

    Stroustrup: You really believe that, don't you? Have you ever sat
    down and worked on a C++ project? Here's what happens:
    First, I've put in enough pitfalls to make sure that only
    the most trivial projects will work first time. Take
    operator overloading. At the end of the project, almost
    every module has it, usually, because guys feel they really
    should do it, as it was in their training course. The same
    operator then means something totally different in every
    module. Try pulling that lot together, when you have a
    hundred or so modules. And as for data hiding. God, I
    sometimes can't help laughing when I hear about the problems
    companies have making their modules talk to each other. I
    think the word 'synergistic' was specially invented to twist
    the knife in a project manager's ribs..

    Interviewer: I have to say, I'm beginning to be quite appalled at
    all this. You say you did it to raise programmers'
    salaries? That's obscene..

    Stroustrup: Not really. Everyone has a choice. I didn't expect
    the thing to get so much out of hand. Anyway, I basically
    succeeded. C++ is dying off now, but programmers still get
    high salaries - especially those poor devils who have to
    maintain all this crap. You do realise, it's impossible to
    maintain a large C++ software module if you didn't actually
    write it?

    Interviewer: How come?

    Stroustrup: You are out of touch, aren't you? Remember the typedef?

    Interviewer: Yes, of course..

    Stroustrup: Remember how long it took to grope through the header
    files only to find that 'RoofRaised' was a double precision
    number? Well, imagine how long it takes to find all the
    implicit typedefs in all the Classes in a major project..

    Interviewer: So how do you reckon you've succeeded?

    Stroustrup: Remember the length of the average-sized 'C' project?
    About 6 months. Not nearly long enough for a guy with a
    wife and kids to earn enough to have a decent standard of
    living. Take the same project, design it in C++ and what do
    you get? I'll tell you. One to two years. Isn't that
    great? All that job security, just through one mistake of
    judgement. And another thing. The universities haven't
    been teaching 'C' for such a long time, there's now a
    shortage of decent 'C' programmers. Especially those who
    know anything about Unix systems programming. How many guys
    would know what to do with 'malloc', when they've used 'new'
    all these years - and never bothered to check the return
    code. In fact, most C++ programmers throw away their return
    codes. Whatever happened to good ol' '-1'? At least you
    knew you had an error, without bogging the thing down in all
    that 'throw' 'catch' 'try' stuff..

    Interviewer: But, surely, inheritance does save a lot of time?

    Stroustrup: Does it? Have you ever noticed the difference between
    a 'C' project plan, and a C++ project plan? The planning
    stage for a C++ project is three times as long. Precisely
    to make sure that everything which should be inherited is,
    and what shouldn't isn't. Then, they still get it wrong..
    Whoever heard of memory leaks in a 'C' program? Now finding
    them is a major industry. Most companies give up, and send
    the product out, knowing it leaks like a sieve, simply to
    avoid the expense of tracking them all down..

    Interviewer: There are tools.....

    Stroustrup: Most of which were written in C++..

    Interviewer: If we publish this, you'll probably get lynched, you
    do realise that?

    Stroustrup: I doubt it. As I said, C++ is way past its peak now,
    and no company in its right mind would start a C++ project
    without a pilot trial. That should convince them that it's
    the road to disaster. If not, they deserve all they get..
    You know, I tried to convince Dennis Ritchie to rewrite Unix
    in C++..

    Interviewer: Oh my God. What did he say?

    Stroustrup: Well, luckily, he has a good sense of humor. I think
    both he and Brian figured out what I was doing, in the early
    days, but never let on. He said he'd help me write a C++
    version of DOS, if I was interested..

    Interviewer: Were you?

    Stroustrup: Actually, I did write DOS in C++, I'll give you a demo
    when we're through. I have it running on a Sparc 20 in the
    computer room. Goes like a rocket on 4 CPU's, and only
    takes up 70 megs of disk..

    Interviewer: What's it like on a PC?

    Stroustrup: Now you're kidding. Haven't you ever seen Windows '95?
    I think of that as my biggest success. Nearly blew the game
    before I was ready, though..

    Interviewer: You know, that idea of a Unix++ has really got me
    thinking. Somewhere out there, there's a guy going to try
    it..

    Stroustrup: Not after they read this interview..

    Interviewer: I'm sorry, but I don't see us being able to publish
    any of this..

    Stroustrup: But it's the story of the century. I only want to be
    remembered by my fellow programmers, for what I've done for
    them. You know how much a C++ guy can get these days?

    Interviewer: Last I heard, a really top guy is worth $70 - $80 an
    hour..

    Stroustrup: See? And I bet he earns it. Keeping track of all the
    gotchas I put into C++ is no easy job. And, as I said
    before, every C++ programmer feels bound by some mystic
    promise to use every damn element of the language on every
    project. Actually, that really annoys me sometimes, even
    though it serves my original purpose. I almost like the
    language after all this time..

    Interviewer: You mean you didn't before?

    Stroustrup: Hated it. It even looks clumsy, don't you agree? But
    when the book royalties started to come in... well, you get
    the picture..

    Interviewer: Just a minute. What about references? You must
    admit, you improved on 'C' pointers..

    Stroustrup: Hmm. I've always wondered about that. Originally, I
    thought I had. Then, one day I was discussing this with a
    guy who'd written C++ from the beginning. He said he could
    never remember whether his variables were referenced or
    dereferenced, so he always used pointers. He said the
    little asterisk always reminded him..

    Interviewer: Well, at this point, I usually say 'thank you very
    much' but it hardly seems adequate..

    Stroustrup: Promise me you'll publish this. My conscience is
    getting the better of me these days..

    Interviewer: I'll let you know, but I think I know what my editor
    will say..

    Stroustrup: Who'd believe it anyway? Although, can you send me a
    copy of that tape?

    Interviewer: I can do that..

  • by f5426 ( 144654 ) on Monday February 21, 2000 @07:07AM (#1256023)
    Will/should name mangling be standardized so different implementations can coexist ?
  • by rambone ( 135825 ) on Monday February 21, 2000 @07:09AM (#1256025)
    After twenty some years, its obvious that object-oriented programming is not a panacea. What are your thoughts on the future of the OO paradigm? What other paradigms do you see challenging it?
  • by ajs ( 35943 ) <ajs@ajs . c om> on Monday February 21, 2000 @07:10AM (#1256026) Homepage Journal
    C has long been the UNIX-world's systems programming language, and still remains that way. I know you don't like to compare C++ to other languages, so I'll just ask if you feel that there are any core reasons why C++ either does not make a good systems prgramming language or failed to capture the interest of the systems C programmers.
  • by spiralx ( 97066 ) on Monday February 21, 2000 @07:11AM (#1256027)

    If you could go back to when you designed C++, what would you change and why?

  • by Ibag ( 101144 ) on Monday February 21, 2000 @07:13AM (#1256030)
    What do you see as the next big thing in programing languages? Is there anything left to do except make the languages closer to english? Also, what current languages do you see as still being around in the future (as in 10 or maybe even 20 years down the road)? What accounts for this longevity?

    Ibag

  • From the FAQ page:

    Did you really give an interview to IEEE?
    in which you confessed that C++ was deliberately created as an awful language for writing unmaintainable code to increase programmers' salaries?

    Of course not. Read the real IEEE interview.


    The real interview is here:
    [att.com]
    http://www.research.att.com/~bs/ieee_interview.h tml
  • by Venomous Louse ( 12488 ) on Monday February 21, 2000 @07:17AM (#1256035)

    Well, this is weird. Just the guy I wanted to talk to this morning!

    It would occasionally be handy to have typedef templates (or template typedefs?! help!), something like this:


    template< class T >
    typedef bool (* func)( const T &r );


    . . . but that doesn't seem to be legal. I don't recall seeing anything about this issue in The Design and Evolution of C++. So what's the deal?

  • by MrHat ( 102062 ) on Monday February 21, 2000 @07:18AM (#1256036)
    I (and maybe most of "us") know you solely through your creation of the C++ language and your assistance in authoring the ANSI standard for said language.

    Aside from this one (albeit major) project, what do you work on from day to day? What projects are you currently involved in? Do you have any more language definitions/standards in the pipeline?


    43rd Law of Computing: Anything that can go wr
  • 1) Did you design C++ because you thought programming was getting too easy and therefore a programmer could not demand the salary they once could when programming was done in machine language?

    2) How would a language like Objective C, which is more Smalltalk like in design, stack up against C++?

  • by MosesJones ( 55544 ) on Monday February 21, 2000 @07:18AM (#1256038) Homepage

    Three linked questionsquestions

    1) Do you think that multiple inheritance is a requirement for a true OO Language

    2) When designing a system with multiple inheritance what do you see as the pitfalls to avoid, especially when it comes to maintainability.

    2) Do you know of anyway to simplifying the readability of multiple inheritance to enable first time users to do less damange.
  • by Edward Kmett ( 123105 ) on Monday February 21, 2000 @07:18AM (#1256039) Homepage
    Is there any hope for the introduction of constrained templates? Right now using templates is an exercise in willpower for the programmer. I know that constrained genericity went before the committee when templates were first introduced, but has there been any thought to revisiting that decision?

    Another item that has gained a lot of momentum in the Eiffel community is Design by Contract, for which I would love to see a standardized approach in C++, but I doubt I'll ever see it.

    Lastly, Bjarne, you were quoted once as saying 'When (not if) reference counting becomes available in C++ that it would be optional' (in a book on object oriented programming languages of which I cannot find on amazon at the moment to post the ISBN). Has much progress been made on the front of making reference counted objects available? Or has your thinking changed since you were quoted?

  • My definition of "systems programming" includes the very lowest levels (right at task scheduling, resource management, interrupt services), all the way up to applications. Surely C++ has been used to write Windows applications, but I've never heard that it comprises most of the operating system proper.

    The original poster asks a good question: is C++ more efficient for those lower-level things (things that would form an operating system kernel, or microkernel servers) than traditional languages (C and architecture assembly)?

    --
  • by jd ( 1658 ) <imipak&yahoo,com> on Monday February 21, 2000 @07:21AM (#1256042) Homepage Journal
    C++ is an Object-Based, rather than a "pure" (in a Software Engineering sense) Object-Oriented language. However, it's still centered around the notion of objects, rather than procedures.

    However, all existing processors are procedural, and there is no real concept of an OO CPU.

    Do you feel that OO languages, such as C++, will result in OO systems, at the hardware level, or will it always be easier to confine OO thinking to the abstract, using extremely complex compilers to translate between OO and procedural paradigms?

  • by roystgnr ( 4015 ) <roy AT stogners DOT org> on Monday February 21, 2000 @07:23AM (#1256044) Homepage
    The biggest complaint I hear about C++ (and agree with myself, depending on whose code I'm reading), is that it gives you enough rope to hang yourself, your company, and your close family.

    Unfortunately, while it's easy to give a language new features without harming backwards compatibility, it's a lot harder to take things out. Are there any features that, in hindsight, you wouldn't have put into C++ to begin with? Are there particular features (templates keep coming to mind) that you would advise inexperienced programmers to avoid?
  • by Anonymous Coward
    If I learn C++, will it make girls like me?
  • by Mr T ( 21709 ) on Monday February 21, 2000 @07:23AM (#1256046) Homepage
    Where do you see programming and languages going? C++ and Perl are both very rich in feature and complex and they seem to be running on less steam than some other more simple lanaguages right now, Java and Python seem to be the darlings. It seems like schools are all teaching java right now and C++ is becoming less of a resume feature than it was a few years back. Do you see a trend towards simplicity? Do you see programming becoming a a divided discipline (IS programming and then system programming, or something along those lines) with CS majors doing the heavy lifting with C++ and IS or non-CS type people doing other stuff with java or cool or something else that is much easier to learn.

    Another question, how do you see funtional programming playing a role in the future? Do you think functional programming is an acadmeic fad or a niche market for special purposes like Ada is used for?

  • by ucblockhead ( 63650 ) on Monday February 21, 2000 @07:23AM (#1256047) Homepage Journal
    Over the course of the last ten years, we've seen some fairly significant changes in C++. Things like the addition of exception handling, templates, the standard template library. Do you think that things have now settled down, or will we see similar changes over the next ten years?

    Also, as a Windows programmer, I spend much of my time grappling with imperfect implementations and proprietary versions of classes. As an example, most Windows programs seem to use the Microsoft specific CString rather than the standard std::string operator for strings. This can cause problems because of the poor way Microsoft has implemented their versions of some of these classes. Is this a problem that will continue to plague us, or do you see all vendors moving towards better support for the standards instead of proprietary APIs?

  • by Tim Behrendsen ( 89573 ) on Monday February 21, 2000 @07:24AM (#1256049)

    I already see a lot of questions being asked that are already on the FAQ list, so here's a handy list, with links:


    --

  • In the past, we've seen radical changes to codebases, especially in the x86 world. Basic to Pascal, Pascal to C, and C to C++. However, things have (IMO) stalled there. C is still widely prevelant in its portability and especially in embedded systems. And Java has failed to really take hold like everyone thought (or hyped) it would.

    With that said, I wonder if you think that with C++ we've reached a stage where a vast set of computing algorithms has been predetermined and the programming model itself has been honed to a fine edge, or do you think that the future holds a bright spot for some new--or existing, such as Perl or Python scripting--language to enter the scene and change programming as we know it again?

    -Daniel.

  • Do you feel that 3rd party extensions to C++, such as Microsoft's ATL "attribute" constuct ( www.geocities.com/~chrisbe/Attribu tes.htm [geocities.com] ), add or detract from the language, and why?

    --
  • by chromatic ( 9471 ) on Monday February 21, 2000 @07:26AM (#1256052) Homepage

    What are your thoughts on languages and the standardization process? Looking at how long it took for C (and C++) to have standards set by ANSI/ISO, and how the most popular implementations are still so very incomplete (MSVC++, even GCC in some ways), one might ask, "Why bother?" Sun might be thinking something similar with Java.

    Is it worth the time and the trouble to be able to create and to point at a sort of Platonic ideal while the rest of the world is chasing a poorly realized reflection of that ideal? What are the benefits of handing over the design of a language to the standards organizations instead of pushing forward with the design yourself (see Python, or Perl, or PHP for successes of the latter)?

    --

  • That's why the original poster had the word "interview" singled out to imply sarcasm.

    -- Give him Head? Be a Beacon?

  • by hanwen ( 8589 ) on Monday February 21, 2000 @07:33AM (#1256057) Homepage Journal
    [Sorry for the potential inflammatory matter in this question].

    How do you relate the complexity of current C++ with the much-touted simplicity of Object Oriented Programming?

    Longer explanation:

    Over the years, the C++ implementation has ballooned; If I recall correctly, your book the C++PL has more than doubled in size. C++ has become a very large and complicated language, and I doubt whether there are any individuals (besides you, that is) that know the entire definition by heart, let alone teams of programmers.

    This means that it is not practical to use C++ fully in any project, and one also has to set strict guidelines for a project what features to use and which not. Seen, in this light, it is doubtful whether C++ has made writing software more manageable. So I think, that as tool for writing better software more efficiently, C++ is a failure.

    C++'s evolution was motivated by a few mottos (you don't pay for what you don't use, C compatibility, etc.), and seen in this light, C++ is a success. Do you think that these mottos need reconsideration?

  • by barleyguy ( 64202 ) on Monday February 21, 2000 @07:33AM (#1256058)
    I realize that you like to avoid comparing C++ to other languages. However, how do you feel about the Eiffel language, and more specifically, what is your reaction to the negativity the Eiffel community seems to show towards C++? Have you ever met any of the founding fathers of other languages, such as Bertrand Meyer of Eiffel or the Sun Java people? If so, was it a positive experience?

  • The original poster asks a good question: is C++ more efficient for those lower-level things (things that would form an operating system kernel, or microkernel servers) than traditional languages (C and architecture assembly)?

    Stroustrup's The Design and Evolution of C++ is a fun read, and it addresses that question. The intent was apparently that C++ would be as close as possible to the efficiency of C, and in fact that was something of a litmus test for new features: "Can we do this efficiently enough that C programmers won't make fun of us?" I myself don't know enough about that low-level stuff to be able to comment on the details. YMMV, etc. etc.

  • by Anonymous Coward on Monday February 21, 2000 @07:45AM (#1256073)
    Okay, in a battle to the death between Linus Torvalds and Bjarne Stroustrup, who would win?
  • You say of The C++ Programming Language:
    this book focuses on concepts and techniques and goes to some pain to be complete and precise.

    In my view one of the greatest strengths of C is K&R, particularly the second edition. In addition to being both complete and precise, it manages to be concise at the same time. One of my major criticisms of your book was that it's unnecessarily wordy. In particular, it takes far too long to get to the first code examples. Having flicked through the 3rd edition in bookshops, it appears to be noticably better in this respect than my version. Was this a deliberate decision on your part, and if so, what prompted it?

  • by egnor ( 14038 ) on Monday February 21, 2000 @07:48AM (#1256075) Homepage
    Templates are one of the most powerful features of C++, and the standard library uses them extensively. However, they're very difficult to implement using the object file/linker system most compilers work with. Most current compiler implementations offer a set of more or less distasteful hacks, each of which has problems (long compilation times, large intermediate files, large output files, complex and fragile "repositories" that parallel the object files).

    For example, the GNU C Compiler's FAQ includes an entry [gnu.org] detailing the available workarounds. Other compilers are similar (in fact, the GCC FAQ entry makes reference to other implementations).

    A number of development shops I've worked in have avoided templates precisely because of these problems, despite their benefits. Code reusability suffers as a result.

    Presumably you didn't have this sorry state of affairs in mind when you were working on the specification. What did you imagine people would do? Abandon object files in favor of some other incremental-compilation scheme? (If so, what?) Are there any compilers that get this "right" in your estimation? In retrospect, would you have done anything differently to encourage compiler vendors to do the "right thing"?

  • Doesn't this imply a bad design for COM, rather than anything about C++?

    I've written Unix daemons in C, Pascal, Modula2, Perl and even Fortran.

    Generally the Unix model of system calls works well in most languages, though some system calls are awkward in some lanaguages (select for example is hard in languages which can't do bit twiddling). I think that expecting people to program in their choice of languages is a good thing, and that os designers & implementers should make it as painless as possible.

  • Actually, the whole Processor-In-Memory philosophy would allow OO to make sense in hardware, as you could attach one processor to one object.

    OO has had limited success, IMHO, because it's very difficult to have one foot in two different paradigms. Compilers aren't fitted with 7-league boots. But, to move into an OO paradigm requires the hardware to be structured to suit OO thinking.

    In a traditional, central CPU, you have a data-stream going in, giving instructions and data. That's fine, for functional thinking, because it's a linear process. OO thinking isn't.

    Processor-In-Memory would allow you to attach a processor to each object, allowing each object to be run independently. You can regard each object as being a seperate computer, almost, with each method being equivalent of a daemon. Your interface is simply how the "sockets" have been set up.

    Done =THIS= way, your compiler doesn't try and linearise the logic. Rather, the compiler would compile each object seperately, and allow the processors within the memory to handle each object as a distinct unit.

  • by jilles ( 20976 ) on Monday February 21, 2000 @07:56AM (#1256085) Homepage
    .. and would ignore backwards compatibility with C, would the resulting language resemble C++? It seems to me (I mainly do Java) that a lot of language features in C++ are less then optimal and heavily biased to performance rather than usability. Templates come to mind but also such things as macros (eeeww).

    I hope you won't put this question aside like you do with most question asking you to compare C++ with <fill in your language here>. While I imagine that the latter type of question must have become a boring one for you, the fact remains that C++ is now more than 20 years old and other languages might exist that address some domains at which C++ was once targeted, better. So rather than asking you to do that I would like you to describe what a modern language should be able to do compared to C++.
  • Surely C++ has been used to write Windows applications, but I've never heard that it comprises most of the operating system proper.

    Actually, as I understand it, Windows, BeOS and countless numbers of research OSes have been written in C++. As for whether it's a good idea or not, I don't know enough about it to have a valid opinion. Search the Linux-Kernel mailing list archives to see some of the arguments for and against using C++ for the Linux kernel.

  • by Christopher H ( 25358 ) on Monday February 21, 2000 @08:01AM (#1256093)
    jd wrote:
    > all existing processors are procedural

    I would argue that existing processors are not innately procedural. Most support a 'state machine' style of programming even more directly. Nearly all instruction set architectures support efficient call stacks, which I guess you could consider a "procedural" feature, but C++ uses these processor facilities just as effectively as C does. A 'tuned for C++ chip' might trim a cycle or two from a virtual function call, but those are already cheap on existing architectures.

    Unless you're suggesting hardware GC, heap management, or persistence, I believe that current processor architectures are well suited to stack-heavy OO languages like C++.

    Digression:
    with all that said, I remember reading about an object-oriented CPU designed by Linn ("Rekursiv"?), back in a mid-80s Byte magazine. It had hardware support for persistence, 40-bit 'object identifiers' rather than pointers, and was apparently used in a production system.
  • Even if you won't recommend a compiler, will you at least tell us which ones you use? How do you decide which compiler is right for a specific purpose? What do you see as the strengths and weaknesses of the various compilers?
  • How do you feel about the fact the fact that there is not one C++ compiler in existance that implements the whole C++ standard?

    bye
    schani
  • I'd love to check them out if just for interest.
  • C++ is the shittiest language ever Really? If you had said "C++ isn't good for system programming", I might agree, but what's wrong with C++ for GUI programming? Have a look at, for example, the KDE source - it's C++, it's readable, it works and it's reasonably fast. If you look at other UIs written in plain C, say GTK/GNOME, you'll notice that many of them actually reinvent some C++ ways. (Yes, I know the difference, but GTK_WIDGET_NEW(a); really isn't much different from QWidget a();). Which language would you pick for creating a GUI? (And why?)
  • I'm quite fond of C++, but obviously it will eventually be replaced by something much greater. As an established language expert, what elements do you think will be found in the next great language? And are there any existing languages that you think are close to this level?
  • Even among programmers who use C++ on a daily basis, there seems to be no shortage of people willing to express varying degrees of distaste for C++. This is similar to the popular dislike among some programmers for Microsoft Windows, in that the loud and frequent negativity doesn't have much of an effect on overall popularity. Do all the jokes and complaints about C++ bother you at all?

  • Something like operator renew[] would be useful. I often still use malloc()/free() because I get to use realloc() with those. Still, if I've got an array of class instances, I'm S.O.L. Granted, operator renew[] would be inefficient and it would require copy constructors on everything, but C++ generally assumes that the programmer has enough sense to come in out of the rain. There are other "caveat user" things in the language already: Take for example pure virtual functions, which a naïve programmer is perfectly free to call in a base class constructor. This would just be another one of those (though you might say there are too many booby-traps already :)

    Certainly one could approach this by overloading operator new[] and operator delete[] and writing an operator_renew() function template using placement new /placement delete , but that would be tedious and goofy. You'd have to write your own allocator.

  • by ucblockhead ( 63650 ) on Monday February 21, 2000 @08:17AM (#1256116) Homepage Journal
    If you are looking at C++, take a look at java first. Because you can comprehend it..

    That's just because you have more time to read the manuals while waiting for your application to run.

  • by Tom7 ( 102298 ) on Monday February 21, 2000 @08:20AM (#1256120) Homepage Journal

    During the design phase, it's difficult to forsee all the issues that will occur in the final implementations (and when the language is put to use).

    What were the biggest misfeatures of C++ (things which added little useful functionality but which make compiler implementation/use/efficiency more nightmarish?)

    On the other hand, what restrictions or concessions turned out to have surprising wins in the same categories?
  • by nonya ( 65503 ) on Monday February 21, 2000 @08:24AM (#1256128)
    I've been playing around with OpenC++ [tsukuba.ac.jp], C++ with a metaobject protocol and I find opening up the compiler in controlled ways like this to be very powerful - and more than just an academic toy. It would allow me to extend C++ in interesting ways to include Delegation (useful for the "Decorator" pattern) and multi-dispatch (useful for the "Visitor" pattern) - along with other interesting extensions (before/after methods, persistance, etc.). I know you considered and rejected both of these features in C++ (if I remember from "Design and Evolution of C++" you rejected Delegation because users found it confusing and you rejected multi-dispatch because it required too complex a linker[1]). I am not questioning your rejection of these features, but I would be interested in your option of a metaobject protocol for C++, which would allow me to add features like these to C++ so it is a closer to my designs. Did you consider a metaobject protocol for C++, and if you did why did you rejected it (too immature? too hard to maintain code? not useful enough to justify the complexity to the language?)

    -Scott
    nonya_cpp_question@yahoo.com

    [1] I should mention my version of Multi-Dispatch doesn't solve the linker problem, it requires you call a function at the start of a program to initialize some tables of pointers to member functions.
  • That girls don't like C++. So what programming language is most likely to get you some?
  • by Signail11 ( 123143 ) on Monday February 21, 2000 @08:30AM (#1256138)
    Why was the decision made not have have references visible as parameters in the calling context of a function call?
  • Sounds like one for MTV's Celebrity Deathmatch. Lets throw Bill Gates in there, too. I'm sure that given the design goals of C++ (Higher salaries for programmers) Bjarne can't be too happy with Visual C++...
  • by Raindeer ( 104129 ) on Monday February 21, 2000 @08:38AM (#1256145) Homepage Journal
    What is your opinion on this fake interview?
  • by SEE ( 7681 ) on Monday February 21, 2000 @08:42AM (#1256152) Homepage
    You said, in "The Design and Evolution of C++" (p. 207), "Within C++, there is a much smaller and cleaner language struggling to get out."

    Do you still beleive this? If so, is it likely that such a language shall be created within the forseeable future?

    Steven E. Ehrbar
  • Funny, that doesn't seem to be doing much to stop Java...
  • by Davorama ( 11731 ) on Monday February 21, 2000 @08:48AM (#1256157) Journal
    What do you think of template meta programming? Do you consider it a boon, enabling clever programmers to do outrageously cool things like the Blitz [oonumerics.org] project? Or is any benefit derived from it's use washed away by the obscure, nearly unreadable code it takes to implement it?
  • by scherrey ( 13000 ) on Monday February 21, 2000 @08:55AM (#1256163) Homepage
    I was introduced to the C++ language in 1989 on the BIX online service by you and Greg Comeau whereupon the both of you set out to demonstrate (and finally convinced me) that this OO stuff wasn't just a fad and that C++ was a language that could efficiently implement it. This was during the time when Computer Language magazine had there "Language of the Month" feature article so languages had a tendency to come and go quickly back then.

    As I recall, the two major goals that you stressed were a) to build a language that could get a handle on these huge projects that C was having difficulties with and b) to provide a balance of features and efficiency so that a developer should have to pay for features he doesn't use.

    From my own experience using C++ in an extreme variety of projects (including very cramped embedded systems and large, multi-platform enterprise systems), there's no doubt that the great progress has been made on the first goal and that the second might have been fully achieved.

    The biggest disappointment to me, however, has been the lack of ability to fully replace plain-old-C in system level development which is an area that stands to gain the most from the language's abstraction features and your stated goals of the language. I understand that early on, it would have been impossible to define standard ABI's since implementation techniques for things such as virtual method and inheritence resolution were very experimental. Now that a full decade has gone by and a surprisingly strong standard has been produced, these differences in implementations are more contrived than based on architectural considerations.

    Presently the Open Source movement is growing wildly in popularity in commercial and non-commercial segments of the industry. Unfortunately, C++ cannot be used to provide linkable API's without either downgrading to severaly limiting C-based linkage or forcing everyone to use the same compiler that wants to call your library because of non-standard representations of structures and calling conventions.

    Do you think that standardized application binary interfaces should be a priority time now? If so, what should be the mechanism used to define these interfaces (defacto vs. formal standards, etc), who should do it, and what can be done to encourage this development?

    Beyond this issue, what are your personal priorities and hopes for the C++ language now?

  • . . . and the STL probably does it with placement new/delete and writing their own allocator. In fat, I seem to recall that placement new and placement delete were added at least partially to keep Stepanov happy . . .

    I guess the implications may well be weirder than I think they are, but it still seems kinda constricting. One question is this: Is it guaranteed that a pointer to item zero in a vector<foo> is in fact a pointer to a contiguous block of memory holding an array of foo? People still have to interact with old C libraries, and people can (and do) derive classes from old prehistoric structs. If I've got a vector of foo, and some function expects a pointer to an array of a struct from which foo is derived (with no additional data members -- I wasn't born yesterday :), where does that leave me? Stroustrup 3 ed 16.3 is not helpful. If std::vector does, in fact, guarantee the above, I'll be a happy camper. I'd also stop and think next time I called erase() on one of 'em :)

  • by Effugas ( 2378 ) on Monday February 21, 2000 @08:58AM (#1256168) Homepage
    Bjarne:

    First, let me take this opportunity to thank you for offering the Slashdot community this chance to interview you. It is highly appreciated!

    As I'm sure you're well aware, computer security has risen to the forefront of risks involved with online business(even beyond "nonexistent paying customers"!). From the external risks of network protocol weaknesses to the internal failure of insufficient buffer overflow prevention mechanisms, the number of "weakest links" available to fall against a determined attacker can be quite staggering.

    In fact, an attacker is often not necessary to make code fall flat on its face--as many computer users can attest to, software written under several software paradigms falls apart in the face of extended but ultimately normal usage.

    My question for you is, as a well respected language designer and programmer, what can we as a community do to deal with these sibling demons of instability and insecurity? Should we adopt languages such as Ada, which place breathtaking amounts of protections into the compile-time phase? Do we move towards the model of simplicity advocated by Schneier, well aware of the exponential increase in unpredictable interactions? Should we worry about the prevalence of interpreted languages as a vector for in-band attacks? What should we be doing that we aren't?

    In short, Bjarne...Where To, Fearless Leader?

    Yours Truly,

    Dan Kaminsky
    DoxPara Research
    http://www.doxpara.com
  • Do you think that articles by Jon Katz are retarding America's youth?

  • I can't see how to implment it with the time-complexity requiremnts demanded without it being an array (plus a little bookkeeping).

    Yeah, I can't think of anything either (not that I'm an algorithm guru by any means). Still, I'm down with the idea that the interface should be guaranteed, but not the implementation.

    why don't you take the SGI STL vector class, rename it, and use it.

    Uhhh, good question :)

  • by jabbo ( 860 ) <`jabbo' `at' `yahoo.com'> on Monday February 21, 2000 @09:32AM (#1256203)
    Assuming that C/C++ is going to remain the One True Systems Programming Language for a long time, I have a question that is purely opinion-based but cries out for your personal opinion as the designer of C++. What scripting language do you feel most closely matches C++ in spirit and implementation? Do you use any of them yourself, to hack together prototypes over larger bodies of code? Do you feel that any of them are advancing the practice of programming in general?

    I noticed in Kernighan & Pike's latest book ("The Practice Of Programming" I believe it is... I gave a copy to a coworker whom I enjoyed sharing a project with) that they give several examples in Perl and Awk, in addition to C, C++, and Java. (I'm going to ignore Java for the time being; I have written plenty of Java code but I feel more confident that C/C++ will run where I want and need it to, plus it's easier to integrate with existing libraries IMHO). What are your feelings on this trend, as evidenced in my application arena by such projects as the mod_perl API to Apache and the AOLserver Tcl API? It may be unnecessary for me to note that Perl seems to be closest to C++ in the way it allows great flexibility (and lets you "blow your whole leg off" ;-)), but you would certainly be a better judge than I!

    I looked through your FAQ and didn't find anything resmbling this question; the folks at Reliable Software convinced me that the STL offers most if not all of the functionality of Perl to a C++-only programmer, but in my experience it wasn't really an apples-to-apples comparison (nothing beats Perl for text processing, for example). Nonetheless I'm sure that you have some insight as to how well a pure-C++ vs. scripting-and-systems-programming approach scales in large projects.

    Anyways, that's all. OOP seems to make my life easier, but user-centered design and rapid prototyping (or just rapid programming) tools like Perl are equally important to getting things out the door. I wondered what you thought of this phenomenon and which tools you select for your work.

  • There are a variety of old C++ implementations floating around on the web and on CDs. I do not recommend an old C++ compiler for learning C++ or for new production use. There is little gained by fighting your way through bugs that have been fixed years ago or limitations that have been lifted years ago by the standard committee.

    IMO Borland 3.0 is still one of the best compilers out there. It doesn't have a whole lot of proprietary commands, it has very readable help files, and it's fast. Newer compilers do stupid things like automatically initializing ints to 0, making it extremely hard to port to other compilers (you get a compiler error if you try to use clrscr() on microsoft, but your program is totally screwed if you accidentally use the initialize-to-0 "feature" of msvc 6 and try to run it on msvc 5.)

    --

  • by zorgon ( 66258 ) on Monday February 21, 2000 @09:42AM (#1256213) Homepage Journal
    I second this question: More specifically, is there going to be a new creation from you such as a (C++)++ ?

    "C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do it blows your whole leg off."
  • After twenty some years, its obvious that object-oriented programming is not a panacea.

    While I can't speak for him, I don't think Bjarne Stroustrup ever said that OO was a panacea. I'll speak for myself instead and give some of my own opinions on it.

    I use OO in C++ regularly these days. However, because of the nature of the projects I have worked on, I have also worked with procedural code: legacy C code, a reporting language, shell scripts. I have also played a bit with generic programming. My conclusion is that the best paradigm for any problem is the one that leads to the simplest solution. OO is best when it elegantly expresses the problem domain.

    I've seen some wonderfully elegant OO C++ code. I've written some good OO C++ code. And I have seen some truly awful inheritance hierarchies that seemed nearly bottomless, with methods inherited from ancestral classes 10 or 12 steps up the tree.

    Back in the mid-80's I was told by an interviewer that I should give up my plans to become a programmer because 4th Generation Languages would make programmers obsolete. A decade and a half later, I am still writing code. The hard part is rarely the expression of the design in code. That is a skill, and an important one, but if it were the hard part of programming, then 4GLs might have made us obsolete. The hard part is analyzing the problem domain and designing the solution. C++ and OO are two tools for achieving the goal of working code and, judging solely from the amount of code written using them and their longevity, good ones.

    Now, has OO run out of steam? No, not really. A more specific question might be: Now that a large number of programmers have been using OO for a while, or trying to, what have we learned about when OO is useful and when other methodologies are more appropriate?
  • by jetson123 ( 13128 ) on Monday February 21, 2000 @09:46AM (#1256220)
    Empirically, large C++-based software systems and component software (including COM/VBX/...) still frequently crash with pointer errors. Even more worrisome are problems where software faults in one module cause incorrect results in another module without actually causing a runtime error.

    Unlike Ada or Java, C++ currently has no facilities that allow a programmer or software engineer to ensure that a fault (e.g. a pointer error) in one component does not cause errors in another component (the facilities that C++ has are advisory).

    The traditional answer has been to use better overall software engineering and design. But that does not work in a world in which components come from various different sources with different standards and coding conventions.

    Java has many problems, but it does have a commitment to runtime safety and fault isolation. And Java's promise really works out in practice: we can combine dozens of independently developed components and trace any software faults to specific components reliably. We'd like to have the safety and decomposability of Java with the efficiency and control of C++, but given the choice, safety and decomposability usually win out for day-to-day applications for us.

    So, what does the future hold for C++ runtime safety and fault isolation? Will future C++ standards mandate more facilities than exist right now? If not, how do you think C++ can survive in a world where software is composed of hundreds of independently developed components?

  • Why not to include a bigger 'operating system abstraction' in the C++ standard library? This is the way to get into the true 'component software development process'. Currently if I want to get some C++ library that do need networking it HAS to relly on another library that do networking and that surelly will depend on a specified OS... I cannot find first order components for C++; they are all second or third order; and we know what this kind of things imply... plataform dependecy. Why not to include, let say, POSIX for example into the C++ standard library? I know, C++ is intended to run on the smaller computer ever build, but it was also C and the 'file' abstraction that days was also a big step. I think it is time to expand the standard library; we need to relly on a bigger 'operating system abstraction' to let the component stuff emerge; as I see it's happenning in the Java world.
  • That was the title of an op-ed [ddj.com] posted at DDJ a couple years ago.

    CPAN is a collection of free, downloadable modules that can be use'd in your Perl programs. It's a wonderful resource and the true strength of Perl. Code gets written once and used and tested by many. Over time the modules just get better tested and more robust. Everybody wins.

    Why doesn't an equivalent CCAN (Comprehensive C++ Archive Network) exist if C++ truly is reusable?

  • by Chris Siegler ( 3170 ) on Monday February 21, 2000 @10:17AM (#1256245)

    OpenSource programmers can write code in whatever language they want. Consequently, they write a lot of C, Perl, and Python. But with some notable exceptions, they don't write C++.

    Contrast that with the lanuages programmers use at work, which are primarily C++ and Java.

    It can't be entirely explained by the size of the programs written either. And as your FAQ says in the section C is better than C++ for small projects, right? [att.com], you believe that any C program can be better written in C++.

    So why the disparity then?

  • by VonKruel ( 40638 ) on Monday February 21, 2000 @10:27AM (#1256256)
    Parameterized types (templates) and OO are two rather different ways of writing generic code. With templates you re-use an external interface (e.g. copy constructor, assignment operator, etc. in the STL). With OO, polymorphism (via dynamic binding) is exploited to achieve re-use.

    Templates have these advantages:

    • compile-time type safety
    • performance (no dynamic binding - function calls can often be expanded inline, avoiding a function call altogether)
    OO has these advantages:
    • simpler programming - you can get some extremely long compiler errors when working with templates
    • less code bloat
    • it seems unfortunate for so much code to be in header files instead of .cpp files (circular #include's can be fun)
    The craziness over template-orientation seems counter-productive to me. Templates are a great feature of C++ and they are the only reasonable way to solve some problems in C++. However, many now seem to think they should be used to solve every problem. I agree that compile-time type safety is a Good Thing, but are we making an intelligent decision given that:
    • dynamic_cast allows safe downward casting in an inheritance hierarchy
    • Moore's law is still going strong : most people writing application software really do not need to obsessively count CPU cycles any more - choosing the right algorithms is more important than an O(1) improvement. Was it Knuth who said "premature optimization is the root of all evil."?
    CPU cycles are becoming more and more plentiful whereas talented designers and programmers are not. Template-orientation seems to make the wrong trade-off. I know that TO and OO can be used together in one program, but they are very different ways of achieving re-use. When should one be favoured over the other?
  • Well versed in programming languages but not particularly well-versed in real world programming. There is a reason while languages like C, C++ and perl are successful. It is a) because they don't tell you what you shouldn't do and b) do what you want them to do quickly. Changing C++ to meet most of that guy's criticisms would either mean keeping programmers from doing what they want to, or would make the language less efficient.

    There is a reason why "academic" languages rarely make it out of acadamia. I remember the PC world in 1986. Pascal made it to the PC first. There is a reason that C became the language of choice on the PC rather than Pascal. It is because it is a practical language, not a language that follows what computer science professors think a language ought to do.

  • Right now Java does not have templates. However there is a proposal to add parametrized classes to the language. Probably this feature will at some time be added to the language. From what I've understood SUN puts the following requirements on such an extension: it should be backwards compatible (both source and bytecode) and it should be usefull enough to justify the added language complexity.
    As I understood, the template feature in C++ is far from perfect. In fact SUN would probably opt out on a similar to C++ template feature in Java.
  • Let me say that while I don't think any language is perfect, and C++ certainly isn't, I use it heavily on a daily basis, and I can't imagine being without it.

    I look forward to any successor languages and tools, as I'm painfully aware that our choice of language greatly impacts the techniques and results we are capable of framing.

    I have a number of years experience of becoming comfortable with the core features of C++ (and some more esoteric bits). I've avoided common use of templates/exceptions because of portability and implementation fears. I think my first question has sort of been alluded to already, but I'm going to restate it in my words in case I'm misinterpreting others questions:

    • I have found virtual functions and large amounts of multiple inheritance to be very helpful in designing diverse categories of objects that often need to be operated on (in many ways) by callers who need not (and hope not to) know the exact type/class of the objects they manipulate. Our current solution with a base class with many virtual functions makes the task delightfully simple for the callers, at the expense of increased storage for the virtual function pointers. I find a desire for a technique of funneling multiple methods through a single base class virtual function and then dispatching them from there in the derived objects. (Eg: Windows MFC message crackers, Amiga MUI method dispatchers, possibly Objective C if I understand it correctly.) Obviously like most OO techniques, you can implement this yourself without support from the language, but as C++ itself has proved, OO techniques are much easier and more robust when the language/compiler supports them.

      Do you feel this is a significant enough technique that it would be considered for future languages (C++ derived or not), or is there a good way to accomplish this in C++ now?

    • You say in your FAQ that you are "looking for fundamental ways of improving the tools and techniques we use to build large real-world systems." Do you foresee a move away from the plain flat-text files, text makefiles, dumb text preprocessor includes, text parsing and the errors/ambiguities it entails, towards a smarter edit/build environment capable of more intelligently managing code/files, minimizing recompiles, easier incremental compiles, etc? As much as I like the flexibility of being able to manipulate flat-text source with a wealth of editors and tools, are we holding ourselves back by doing so?

    Keep up the good work.

  • How do you feel about C++'s development into a template for a universal syntax for other languages? Is it appropriate to continue using C++ as a guide for other languages? Java, JavaScript, Perl, and many other languages have parts or are comprised almost entirely from C++ syntax. Should this trend continue? Thanks, Travis forkspoon@hotmail.com
  • Modern computer languages seem to have smaller lexicons and more abstraction - making them easier to learn. In the future, a voice controlled editor and an advanced language could allow computer programs to be written in limited natural english*.

    In other words, a computer program could be written to be understood by any English* speaker, with hopefully decreased training time and improved teamwork.

    Do you foresee any possible use for a "natural" programming language?

    *English is my first choice since I speak it; other people may differ.
  • It seems to me that a lot of the programmers who prefer C++ do so mainly because C++ is what they were exposed to in school, rather than other programming languages and other systems of OO programming. The reason I've learned C++ (rather than simply C) is because my university [rpi.edu] decided that C++ would be a good language to teach students in the process of teaching computer science. This is an interesting choice, to say the least. Besides all the difficulty of the strict memory management required by C, many introductory computer science students struggle with C++'s implementation of templates and operator overloading - two programming models which seem to complicate the language a lot without adding much in the way of new functionality or useful structure.

    Where do you see C++ in relation to education and it's role as a student of computer science's first programming language?

  • by Kythorn ( 52358 ) on Monday February 21, 2000 @11:18AM (#1256288)
    In the name of God, WHY? For the love of all that we hold sacred and holy, WHY?!?
  • by David A. Madore ( 30444 ) on Monday February 21, 2000 @11:22AM (#1256290) Homepage

    One of the the features that C++ can be said to lack, as a high-level language, is a garbage collector. Or rather, it's not so much that no collector exists (the Hans Boehm conservative C/C++ garbage collector [hp.com] is one, after all) but the fact that it isn't well integrated in the C/C++ API.

    Do you regret this? Do you think someday we'll have a decent programming language with a garbage collector (i.e. one which is well integrated in the language and not just an add-on)? Java might have been just that only its eficiency (notably that of the GC) was terrible: do you think that was a necessity or just a consequence of the wrong decisions being made?

  • by Coward Anonymous ( 110649 ) on Monday February 21, 2000 @11:27AM (#1256291)
    Was there no way to avoid having private members (data and methods) of a class in the main definition of a class?
    One of the ideas of OO is information hiding and encapsulation of implementation details.
    Private data members declared in a class definition used by external objects runs counter to these OO concepts. Other objects are supposed to be "blind" to the inner workings of the object and yet see private methods and data members.
    IMHO it is also a major hassle in the earlier stages of a new project or new additions to a project, when changes in the inner workings of classes are frequent.
    I realize that part of the problem is the need to know the size of the object for memory allocation purposes.
    Did you think of this contradiction when designing C++ and were there any attempts at solving it?

  • Do you want to see anything added to the standard C++ library that is not already there? (For example, a standard set of design patterns.)

    Along the same lines, do you think sockets and graphics should be standardized as part of a language?
  • Most programmers that I know prefer Java, the programming language, over C++. What they dislike about Java is the VM and bytecodes slowing everything down. Hence my question

    Will ahead-of-time Java compilers, like
    GCJ [cygnus.com] for instance, eventually be able to produce machine code comparable in speed to compiled C++?

    The problem I see so far is that on the Java side there is the problem of making exceptions faster, which are notorious for slowing down C++ code. And Java has to deal with garbage collection, which you say in your FAQ can be added to C++. Yet, despite its obvious benefits, nobody seem to do.

  • No, it doesn't.
    1) void foo( Bar bar );
    2) void foo( const Bar& bar );

    foo in 1 and foo in 2 cannot be overloaded because their formal parameters types are identical. This is not a problem; no compiler can reasonably disambiguate the function calls at compile time or even run time for that matter. What I'm thinking of is that there is no way to tell whether an arbitrary function call (ie. foo(x)) is passing a value or passing by reference by examining the context of the point at which the call is made.
  • In your FAQ, you say that you are working on "fundamental ways of improving the tools and techniques we use to build large real-world systems."

    That's been on your FAQ for at least 3 years now. What can you tell us about this work? What have you found?

  • "Problems in software design are not solved by abstracting things away from the implementer. It amounts to hiding the dust under the carpet."

    And excellent argument for abandoning C and sticking with assembly :-)

    But you're missing the whole point of OO. If you have a problem that lends itself to OO abstractions, then it makes every bit of sense to use OO. Like it or not, every programmer uses abstractions. I mean, you not programming with just bytes still, are you? Thankfully, we now have bytes, chars, ints, uints, floats, and bools, as well as strings, arrays, sets, enums and structs. And there are a lot of problem sets that are easier to abstract to objects than to algorithms.

    As a case in point, take a look at X programming and widgets. Qt is C++, and even though GTK+ is written in vanilla C, it still uses OO like abstractions. That's because it makes *sense* to think of widgets as objects. A pushbutton is more than just an area in memory 30-40 bytes long. If you need to make a toggle button, it makes more sense to start with a pushbutton than to rewrite every bit of pushbutton code from scratch.

    I struggled for years with C. But with C++, I was more productive than ever after only three months. That's because C was a metaphorical hammer that made every problem look like an algorithm. But C++ gives me more choices in how I can break a problem down. With C++ I can choose between algorithm-oriented or object-oriented methodologies.
  • You are one of those who "reinvented" a language. And you made a fundamental move by giving macro-assembler C style the true aspects of a language. In one way you were not alone. Somehow your move was made in a time when several languages tried to turn "objective" or "procedural". It was a great move that gave programming languages a property of high flexibility.

    Than there was a big gap. And suddenly we had Java. However there was nothing fundamentally new on it. Theoretically I mean.

    What do you think about this? Have we reached a theoretical limit in the technological bounds of modern computing? Have "theoretical" programmists lost their "inspiration". Or have we reached "Finis Terra" of the programming sciences?
  • Embrace and Extend. It's what condemn Microsoft for doing. Embrace a standard, then extend it so no one else can use it without you.

    Yet this is precisely what glibc is doing. It's taking a language and library that is firmly standardized, then adding its own extensions, so that developers end up being locked into the GNU toolset. I tried to compile a program that other day on Solaris. It failed miserably because it depended upon GNU extensions to the "standard" C library. Sure I can load up glibc to run it, but why should I when I've got a perfectly capable and standardized libc? GNU libc tries to be everything including the kitchen sink (sound familiar?).

    GNU would do everyone a lot better if they kept their extensions separate from the standard.
  • I have read that the processor overhead associated with objects keeps C++ from being "speed competitive" with tightly coded C or more especially with Fortran.

    What is your opinion on this alleged "speed penalty", and do you think future versions of the language and/or compiler technology will be able to reduce or eliminate it?

  • C and C++ share a declaration syntax that, I think it is fair to say, is an acquired taste at best. Damian Conway, an OO programming researcher in Australia has published papers on a Modest proposal to resyntax C++ [monash.edu.au] with a graduate student of his, B. M. Werther.

    The result was a language with C++'s semantics (at that time) and a much cleaner syntax. Which, of course, went nowhere. Do you have any comments on SPECS itself or any other attempts to improve what might be called the "human factors" aspects of the C++ language?

  • by Y ( 13582 ) on Monday February 21, 2000 @12:23PM (#1256327)
    making garbage collection standeard in C++ would be that it would reduce the language a bit by forinstance forbidding typecasts between pointers and integers

    You lost me there. Why would garbage collection prohibit that?

    At the basic machine level, everything in the computer's memory is just bits. As such, a garbage collector, without having some sort of memory markup, cannot tell if a memory address holds a value or a pointer to another address. One of the better forms of garbage collection is copy collection, which just reaches the memory currently being used - all other memory is ignored. It does this by following pointers. I believe Java implements this form of GC. If the garbage collector can't tell if a memory address holds a pointer or a value (as is the case with C++, which will allow all kinds of crazy casts), it can't know if the data it's looking at is needed or not.

    As it is, garbage collection in C++ can only be conservative, which collects iff there is no doubt that freeing that particular memory address is a safe operation. Naturally, this is much less efficient than only accessing memory in use.

    There is a saying, "Objects die young." Most objects that are instantiated are only there for the duration of a function call. Assuming this to be generally true, copy collection is very efficient, because it won't have to access most of the instantiated objects. Hand allocation/deallocation requires that you touch every piece of allocated memory. Saying that hand allocation/deallocation runs more efficiently than GC only holds true for conservative collectors. More formally put, GC runs in O(memory in use) and only runs when memory runs out. This is multiplication by a constant, so it is still O(memory in use). Hand (de)allocation runs in O(allocated memory). If memory in use = allocated memory, than you can't free anything anyway.

    The power of pointers is its weakness. You can't guarantee object integrity when you can randomly write to the memory holding the object.

    And if you can't guarantee object integrity, you can't guarantee good garbage collection. GC really doesn't belong in C++.

    - Y
  • You're correct, java in implementation is flawed, but so is C++. Perl and Python are exceptions simply because there is no choice in implementation. Presumably java will settle down some, maybe it won't.

    I meant the language itself. Java, as a language, is dramatically more simple than C++. It's stunning. Not to be defamatory, but python is the same way compared to perl. Both python and java are getting lot's of attention and hype right now. Perl and C++ have a lot in common in that they've evolved over years and lot's of new things have been added to them while trying to remain backwardly compatible. There is a lot to learn to know "all of C++" or "all of perl"

  • From the headquarters of the C++-Haters Association...

    Seriously. Like many of the posters so far, I program in C++ every day. Unlike many of those, I _really_ hate it. It's probably a question of cultural differences: I was raised on Lisp, and, even though I'm not really religious about it, I still find C++ to be, all in all, an enormous kluge.

    I really do wish I could move to another language, but unfortunately, the Lab standardised on C/C++/Fortran some ten years before I got hired, and I don't really have a say about it.

    So the point of the matter is: what can you, Bjarne, do for me, Kaufmann? Can you at least post a memo saying something like: "To the Mgmt. and J. Clueless PHB: C++ is _not_ a god-send. Not _all_ programming should be done in C++. Alternative language research _should_ be encouraged. Sincerely, - The Bell Labs gang"

    Thanks for the time,

    -- Rafael Kaufmann, CPPHA member

    (Note to moderators: not a flame, not a troll.)
  • Given the rise of such quirky languages like Perl and Python, which both use weaker typing, automatically garbage collect and provide associative arrays, would you add or remove any features from C++? Would you provide for more robust string handling?

  • Java, after the hype (Score:6, Interesting)
    ...
    Moderation Totals:Interesting=6, Total=6.
  • One other place where object-orientation is particularly useful is in user interfaces; in your average interface (especially GUIs, but curses interfaces can have this too) you have absolutely TONS of places where you want to do objectey things.
    Now, it's not necessarily object-orientation done in the C++/Java style (as a random example, GTK+'s signals don't map well at all onto that object framework) but it is almost always object-oriented to some degree.

    Daniel
  • by JordanH ( 75307 ) on Monday February 21, 2000 @12:52PM (#1256352) Homepage Journal
    This is a question almost certainly better suited for others, but, unfortunately, those others aren't being interviewed. Fortunately, I believe you probably have some perspective on it.

    From your FAQ [att.com], it appears you have strong opinions on the relative merits of C vs. C++ for most applications. I quote, in particular:

    • C is better than C++ for small projects, right?

      Not in my opinion. I never saw a project for which C was better than C++ for any reason but the lack of a good C++ compiler.

    Do you have any idea why C++ was rejected as the implementation language by the most experienced C programmers, those folks now at lucent.com (Dennis Ritchie, Rob Pike, et al), for their most visible projects, Plan 9 and Inferno?

    Surely, these people had access to a good C++ compiler.

    If I may have a follow up, but closely related, question. Was the division of the Bell Labs Research staff between Lucent and AT&T related to a division of opinions concerning C and C++?


    -Jordan Henderson

  • While I find the flexibility and power of C++ to make it the best overall tool for my programming, I often find that when I get something wrong, the error is almost impossible to find.

    What could be done to reduce the incidence of errors and improve the debuggability of C++ code, either through changes to the language, restricting the developer's freedoms, or by improvement of available tools.

    Context: I have moved to Linux development from NT, and *really* miss BoundsChecker!
  • And of course, some of us are very interested in getting compiled Java (i.e. gcj/libjava [cygnus.com], part of the gcc project) to work. I have contributed to this project in the past, with the hope of someday maintaining 1 set of Java libraries which I can either run in a JVM like Sun's or kaffe (for portability) or compile for my platform (for speed).

    So, I would rephrase the question to something more like " JVM issues aside, what do you think of the future of Java as a language?"

    JMC

  • there are other paradigms...one that has been convincingly applied is to use a robust high performance platform based on an open standard (like Apache), and use easy to understand extension languages to extend the platform through a known interface.
  • Its not a technology issue - its a marketing issue. Eiffel is not only poorly marketed, but there aren't any major open source Eiffel-based projects that would spur developers to learn more about it. For at least another three years, C is king, as much as it chaps me to admit it.
  • This means that it is not practical to use C++ fully in any project ...

    Well, what are you trying to do? Are you trying to make sure you use every last feature of a given system, or are you simply trying to get the job done?

    C++ is very complex. So are Unix, and Common LISP, and X11, and countless other systems. However, you don't have to use all of a system's features in order to use that system. Use what you need to get your job done to satisfaction.

    Larry Wall (the creator of Perl) has said, "A Perl script is 'correct' if it gets the job done before your boss fires you." There is a lesson there: Don't get so caught up on the tools that you forget that the tools are there to help you do your job. The same applies to C++.

    This has been a public service message from DragonHawk. ;-)
  • OpenSource programmers can write code in whatever language they want. Consequently, they write a lot of C, Perl, and Python. But with some notable exceptions, they don't write C++.

    I'm not entirely sure your assertion (that C++ is significantly less used for OSS then other languages) is correct. KDE comes to mind.

    But, for the purpose of discussion, let us accept it as given.

    Contrast that with the lanuages programmers use at work, which are primarily C++ and Java.

    You've got a number of factors here.

    The biggest concern for software maintenance is what system is already in use. If you've got a program written in language XYZ, then you continue to use XYZ. Look at the large number of COBOL programs still in use today for proof of this.

    If you're (re)implementing from scratch, the biggest concern is: What is available to use? For many systems, the answer is C, because C is still far more universal and "settled" then C++ is. This doesn't mean C++ is bad, it just means C has been around longer.

    Follow that up with: Who is making the decisions?

    For a corporate project, it is the managers. Managers look at studies, benchmarks, and marketing info (lots of that), and decide which language is "the best". Unfortunately, many managers assume "newest" equals "best". This leads to Java, C++ and such being used, not because they are or are not better then alternatives, but because they are currently popular and getting attention. This leads to a network effect where more "new" software is written for C++, giving the impression that C++ is even better.

    Note that I'm not asserting that C/C++/Java/whatever is better then C/C++/Java/whatever. I'm simply saying that quality is not the only consideration to PHBs.

    Now, look at your typical OSS project. It is coordinated by a few people, maybe just one. They are going to pick the language they are most familiar with. This means C is chosen a lot, simply because it has been around longer, so they know it better.

    As far as Perl and Python go, they are predominately scripting languages, and generally don't target the same problem space as C++. (Yes, I know that is an over-generalization, but as such things go, it isn't that far off).

    Just my 1/4 of a byte. ;-)
  • I think the troll in question is actually kind of funny, so I don't think the moderation is inappropriate, but I want to make sure all involved realize that the above comment was posted by "Hemos.", not "Hemos". Not the period (.) at the end of the poster's handle.
  • A few things I've noticed throughout this discussion is almost ignorance of newer languages and language ideas.. Do not forget that the average software engineering development takes 18 YEARS to be put into widespread use.

    OO has been with us since 1980. Its only in the mid-90's that its become big. Similarily, the new language ideas that have been developed relatively recently (functional programming--haskell, sml-nj, ocaml) will be the languages of the future in another 10 years.

    In these languages..Here I will refer to SML-NJ, as I am most familiar with its type system, they are strongly typed. Polymorphic; lists are TRULY polymorphic, Unlike templates, there's no code duplication. They are also extremely strongly typed. In actuality they have an order of magnitude more typing information than C++ has, except that I don't care because the compiler itself intelligently infers all of that typing information fully automatically. Functions are truly first-order values. They may be 'created' at runtime (via partial application or closures), stored, passed around, and anything else.

    SML is also much more understandable and more consise. It also has a module system that's extremely careful. You cannot even compile a program that violates the module system. As a language, the specification is well under 100 pages of carefully formalized mathematics.. (Though a careful analysis of SML shows that there are 'dusty corners' in the specification. My research right now deals with specifying a language so explicitly that an automated theorem proving system can prove the 'correctness' of the language specification. If anyone's interested in the tools I'm using, www.twelf.org.)

    As far as consiceness and modularity: Remember the law of software engineering, half the number of lines of code means 5x easier to analyse, debug, and maintain.

    As for the other languages, haskell has an even more versatile type system than SML-NJ has, I think its powerful enough to handle most of the typing characteristics of OO programming. OCaml is another language in this group.

    While its still true that none of these languages are ready for prime time yet, I suspect that derivatives from them (like ML-2000) may be the language of the future; the languages that everyone will be calling the pancea in 10 years.

    Given that it will probably be at least a decade or two until the next 'big thing' comes out, what things currently in the pipeline do you think will be big? Will it be the strongly typed functional languages? Will it be the a Java-style IDE where people don't think of a program as a set of linear text files but rather as a collection of objects and methods?

    Another way of asking the same question, what abstractions do you feel will be the ones exploited in the future? Will the IDE abstract away the textual or linear representations of the code? Will typing, interfaces, and modularity be used to abstract away the objects implementing an interface? Will we finally have a good application programming language which completely abstracts away the ideas of bits, bytes, pointers?

    Or, should I shut up because I've been around 'academic' language designers too much, who don't know how to make a language that the majority would accept?

There is no opinion so absurd that some philosopher will not express it. -- Marcus Tullius Cicero, "Ad familiares"

Working...