Bjarne Stoustrup

This is a discussion on Bjarne Stoustrup within the A Brief History of Cprogramming.com forums, part of the Community Boards category; it's weird how easy it is to contact this guy. you would think the creator of c++ would be too ...

  1. #1
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    Posts
    2,493

    Bjarne Stoustrup

    it's weird how easy it is to contact this guy. you would think the creator of c++ would be too busy for answering e-mail personally.

    anyway, here's my email conversation: (sorry for doubting you, dean)

    my original message to him:
    hello
    i've been thinking about the development of c. on a small scale, in mostly
    integer programs, the x86 assembly program and its equivalent c program match
    each other closely. for instance:

    test.c:
    int main() {
    int x;
    x = 1;

    return x+3;
    }

    test.asm:
    enter 0,0
    xor eax,eax
    add eax,3
    leave
    ret


    this is not the best example, but demonstrates the close link of c operators
    to assembly commands. other examples:
    dest += src; and add dest,src
    ++dest; and inc dest;

    C++ differs from this line of thinking. for instance, the scanf function must
    take in variables with reference operators attached to them. the scanf
    function then uses that address to return values back. c++ introduces the
    ability to use the same variables through other child functions without the
    need for reference operators.

    void example(int& x);

    this makes a potential scanf in c++ more elegant to use, and to create. my
    point is that this seemingly easy to implement idea is neglected in C but
    added in C++ on the basis of its relationship to the equivalent assembly
    language commands.

    what do you think? thank you for your time.

    --(name withheld from you guys, my name goes here)
    his response:
    >Delivered-To: bs@research.att.com
    >X-Authentication-Warning: mail-red.research.att.com: postfixfilter set sender
    to geoschnee2@thetruth.com using -f
    >Date: Tue, 03 Sep 2002 00:46:40 -0400
    >From: g s <geoschnee2@thetruth.com>
    >To: <bs@research.att.com>
    >Subject: x86 assembly, c, and c++
    >Mime-Version: 1.0
    >X-Spam-Status: No, hits=0.0 required=5.0 tests= version=2.20
    >X-Spam-Level:
    >Content-Transfer-Encoding: 8bit
    >X-MIME-Autoconverted: from quoted-printable to 8bit by day.research.att.com id
    g834knE01062
    >
    >hello
    >i've been thinking about the development of c. on a small scale, in mostly
    >integer programs, the x86 assembly program and its equivalent c program match
    >each other closely. for instance:
    >
    >test.c:
    >int main() {
    > int x;
    > x = 1;
    >
    > return x+3;
    >}
    >
    >test.asm:
    >enter 0,0
    >xor eax,eax
    >add eax,3
    >leave
    >ret
    >
    >
    >this is not the best example, but demonstrates the close link of c operators
    >to assembly commands. other examples:
    >dest += src; and add dest,src
    >++dest; and inc dest;
    >
    >C++ differs from this line of thinking.

    Not really. The code generated for individual C++ constructs are as predictable
    as that generated from C constructs.


    >for instance, the scanf function must
    >take in variables with reference operators attached to them. the scanf
    >function then uses that address to return values back. c++ introduces the
    >ability to use the same variables through other child functions without the
    >need for reference operators.
    >
    >void example(int& x);
    >
    >this makes a potential scanf in c++ more elegant to use, and to create. my
    >point is that this seemingly easy to implement idea is neglected in C but
    >added in C++ on the basis of its relationship to the equivalent assembly
    >language commands.
    >
    >what do you think? thank you for your time.

    Remember that access through a reference will involve exactly the same machine
    operations as access through a pointer for equivalent uses.


    >--(name withheld)
    >

    - Bjarne
    Bjarne Stroustrup, http://www.research.att.com/~bs
    my response:
    >>for instance, the scanf function must
    >>take in variables with reference operators attached to them. the scanf
    >>function then uses that address to return values back. c++ introduces >the
    >>ability to use the same variables through other child functions without
    >the
    >>need for reference operators.
    >>
    >>void example(int& x);
    >>
    >>this makes a potential scanf in c++ more elegant to use, and to create. my
    >>point is that this seemingly easy to implement idea is neglected in C but
    >>added in C++ on the basis of its relationship to the equivalent assembly
    >>language commands.
    >>
    >>what do you think? thank you for your time.
    >
    >Remember that access through a reference will involve exactly the same
    >machine
    >operations as access through a pointer for equivalent uses.

    why wasn't this syntax included in standard c? in the development of c++ was
    this idea just some additional syntactic sugar, or was it put there for a
    greater purpose? (by greater purpose i mean does it contribute to c++'s other
    major improvements?)

    --(name withheld)
    And his response to that:
    >Delivered-To: bs@research.att.com
    >X-Authentication-Warning: mail-pink.research.att.com: postfixfilter set sender
    to geoschnee2@thetruth.com using -f
    >Date: Tue, 03 Sep 2002 18:07:54 -0400
    >From: g s <geoschnee2@thetruth.com>
    >To: Bjarne Stroustrup <bs@research.att.com>
    >Subject: Re: [Re: x86 assembly, c, and c++]
    >Mime-Version: 1.0
    >X-Spam-Status: No, hits=0.0 required=5.0 tests= version=2.20
    >X-Spam-Level:
    >Content-Transfer-Encoding: 8bit
    >X-MIME-Autoconverted: from quoted-printable to 8bit by day.research.att.com id
    g841uWE10188
    >
    >
    >>>for instance, the scanf function must
    >>>take in variables with reference operators attached to them. the scanf
    >>>function then uses that address to return values back. c++ introduces >the
    >>>ability to use the same variables through other child functions without
    >>the
    >>>need for reference operators.
    >>>
    >>>void example(int& x);
    >>>
    >>>this makes a potential scanf in c++ more elegant to use, and to create. my
    >>>point is that this seemingly easy to implement idea is neglected in C but
    >>>added in C++ on the basis of its relationship to the equivalent assembly
    >>>language commands.
    >>>
    >>>what do you think? thank you for your time.
    >>
    >>Remember that access through a reference will involve exactly the same
    >>machine
    >>operations as access through a pointer for equivalent uses.
    >
    >why wasn't this syntax included in standard c? in the development of c++ was
    >this idea just some additional syntactic sugar, or was it put there for a
    >greater purpose? (by greater purpose i mean does it contribute to c++'s other
    >major improvements?)

    The key need that led to the introduction of references in C++ was the need to
    provide efficient implementation of overloading. If a and b are matrices, you
    want a+b to pass pointers/references to a and b to the addition operator - not
    copying the large objects, and requiring explicit use of address-of would
    distract from conventional notation (i.e. &a+&b is unacceptably ugly).

    For more information, see "The Design and Evolution of C++"



    >--(name withheld)
    >

    - Bjarne
    Bjarne Stroustrup, http://www.research.att.com/~bs

  2. #2
    Has a Masters in B.S.
    Join Date
    Aug 2001
    Posts
    2,267
    >syntactic sugar

    i like that one...

    he might get paid to answer ?'s there are a number of companies that pay their coders to do this, remember he works/worked for AT&T.

    or maybe he's just nice?
    ADVISORY: This users posts are rated CP-MA, for Mature Audiences only.

  3. #3
    Banned Troll_King's Avatar
    Join Date
    Oct 2001
    Posts
    1,784
    I wonder what he thinks about modeling and implimenting an OS in C++. That's what I'm thinking of doing so that I can stop fighting with Microwimps.

  4. #4
    aurė entuluva! mithrandir's Avatar
    Join Date
    Aug 2001
    Posts
    1,209
    Bjarne seems like a really nice chap


    >>I wonder what he thinks about modeling and implimenting an OS in C++. That's what I'm thinking of doing so that I can stop fighting with Microwimps.<<

    He'd probably say you're crazy

  5. #5
    flashing vampire black's Avatar
    Join Date
    May 2002
    Posts
    563
    the guy acts as God...
    Never end on learning~

  6. #6
    Banned Troll_King's Avatar
    Join Date
    Oct 2001
    Posts
    1,784
    What would he say about multinational control of satellite communications and the global internet superhighway. Information control as a means to cultural domination....

  7. #7
    ----------
    Guest
    Interesting, looks like your assembly left out this statement:

    x = 1;

  8. #8
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    Posts
    2,493
    doh... i overlooked that.

    you would just need to change
    xor eax,eax
    to
    mov eax,1

  9. #9
    ----------
    Guest
    When I saw this, I kind of figured you were probably playing around with different versions of the code, with x initlialized to 0 in one version.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Visit from Bjarne Stroustroup
    By Tonto in forum A Brief History of Cprogramming.com
    Replies: 23
    Last Post: 11-12-2008, 09:22 AM
  2. Interview with Bjarne Stroustrup "C++ a joke"
    By novacain in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 03-31-2003, 11:55 PM
  3. Exclusive Interview With Bjarne Stroustrup
    By Osama Lives in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 05-07-2002, 04:17 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21