C and C++

Discussion in 'C++' started by wilberX, Mar 3, 2006.

  1. wilberX

    wilberX Guest

    I have a question on how closely C and C++ are related. If i am
    correct C++ is OOP while C is not. Now how closely can an OOP language
    and a procedural language be related? How much knowledge of C is
    required to understand C++? Thanks.
    wilberX, Mar 3, 2006
    #1
    1. Advertising

  2. wilberX wrote:
    > I have a question on how closely C and C++ are related. If i am
    > correct C++ is OOP while C is not. Now how closely can an OOP language
    > and a procedural language be related? How much knowledge of C is
    > required to understand C++? Thanks.


    Start here: http://public.research.att.com/~bs/bs_faq.html

    V
    --
    Please remove capital As from my address when replying by mail
    Victor Bazarov, Mar 3, 2006
    #2
    1. Advertising

  3. wilberX

    Phlip Guest

    wilberX wrote:

    > I have a question on how closely C and C++ are related. If i am
    > correct C++ is OOP while C is not. Now how closely can an OOP language
    > and a procedural language be related? How much knowledge of C is
    > required to understand C++? Thanks.


    To what purpose will you put the answer?

    C++ is C with a few keywords added and just a couple bugs removed.

    Those new keywords permit better OOP style. Folks have written OOP in C
    since forever; it's just harder.

    Now you define OOP before asking what the difference between the languages
    is.

    --
    Phlip
    http://www.greencheese.org/ZeekLand <-- NOT a blog!!!
    Phlip, Mar 3, 2006
    #3
  4. wilberX

    Mike Wahler Guest

    "wilberX" <> wrote in message
    news:...
    >I have a question on how closely C and C++ are related.


    Fairly closely.

    > If i am
    > correct C++ is OOP while C is not.


    C++ has native facitilies which support OOP,
    but that's only one of several programming styles
    it supports.

    >Now how closely can an OOP language
    > and a procedural language be related?


    C++ isn't *only* an OOP language. One can
    write procedural code with it as well. Both
    C and C++ can be considered 'general purpose'
    languages.

    How 'close' C and C++ are depends upon your notion
    of 'close'. E.g. the syntax of one is quite similar
    to that of the other. But the semantics are often
    different.

    > How much knowledge of C is
    > required to understand C++?


    None at all.

    > Thanks.


    You're welcome.

    -Mike
    Mike Wahler, Mar 3, 2006
    #4
  5. Phlip wrote:

    >
    > C++ is C with a few keywords added and just a couple bugs removed.
    >


    I wouldn't characterize C++ so lightly. Have you forgotten about
    operator overloading, exception handling, templates, namespaces, and
    the STL?? A person graduating from C to C++ has somewhat of a steep
    learning curve if he/she wants to develop good, quality code.

    > Those new keywords permit better OOP style. Folks have written OOP in C
    > since forever; it's just harder.


    True, one can essentially create an "object" using the struct
    mechanism.

    Mike.

    -----
    ACGNJ Java Users Group
    http://www.javasig.org/
    Michael Redlich, Mar 3, 2006
    #5
  6. wilberX

    BigBrian Guest

    Michael Redlich wrote:
    > Phlip wrote:
    >
    > >
    > > C++ is C with a few keywords added and just a couple bugs removed.
    > >

    >
    > A person graduating from C to C++ has somewhat of a steep
    > learning curve if he/she wants to develop good, quality code.


    Your statement sounds like you're infering that C++ is better than C
    since you suggest that people graduate from C to C++. This really
    isn't true in every case, both languages have tasks for which each is
    better than the other. The linux kernel is writen in C, not C++. I
    would bet most of the developers for the linux kernel would take issue
    with the statement that they needed to graduate to C++.

    > > Those new keywords permit better OOP style. Folks have written OOP in C
    > > since forever; it's just harder.

    >
    > True, one can essentially create an "object" using the struct
    > mechanism.


    True, but that's not enough to support OOP. You also need to implement
    your own way of handling dynamic binding to support polymorphism.

    -Brian
    BigBrian, Mar 4, 2006
    #6
  7. wilberX

    osmium Guest

    "wilberX" writes:

    >How much knowledge of C is
    > required to understand C++? Thanks.


    None at all is required. C++ is a complete (albeit irritating) free
    standing language
    osmium, Mar 4, 2006
    #7
  8. BigBrian wrote:
    > Michael Redlich wrote:
    >> Phlip wrote:
    >>
    >>>
    >>> C++ is C with a few keywords added and just a couple bugs removed.
    >>>

    >>
    >> A person graduating from C to C++ has somewhat of a steep
    >> learning curve if he/she wants to develop good, quality code.

    >
    > Your statement sounds like you're infering that C++ is better than C
    > since you suggest that people graduate from C to C++. This really
    > isn't true in every case, both languages have tasks for which each is
    > better than the other. The linux kernel is writen in C, not C++. I
    > would bet most of the developers for the linux kernel would take issue
    > with the statement that they needed to graduate to C++.


    The debate of "this language is better than that language" is pointless,
    especially when the arguments given have no merit. Linux kernel is not
    written in C because C is "better". It's written in C because most of
    who are contributing, have no time, nor desire to graduate to C++. Or
    because they are simply afraid or contemptuous (or both).

    V
    --
    Please remove capital As from my address when replying by mail
    Victor Bazarov, Mar 4, 2006
    #8
  9. Michael Redlich wrote:
    > True, one can essentially create an "object" using the struct
    > mechanism.


    You can program in entirely object oriented ways in C! The first
    extensive use of object oriented programming in C I came across is
    Xt, the X toolkit implementing widgets on top of X11. Each widget
    was derived using a certain convention on how to use structs. This
    supported run-time polymorphism very much like 'virtual' functions
    do in C++. Of course, this required some form of manual set up of
    something similar to a virtual function table (effectively a struct
    describing the class and which function to call effectively).
    --
    <mailto:> <http://www.dietmar-kuehl.de/>
    <http://www.eai-systems.com> - Efficient Artificial Intelligence
    Dietmar Kuehl, Mar 4, 2006
    #9
  10. Victor Bazarov wrote:
    > The debate of "this language is better than that language" is pointless,
    > especially when the arguments given have no merit. Linux kernel is not
    > written in C because C is "better". It's written in C because most of
    > who are contributing, have no time, nor desire to graduate to C++. Or
    > because they are simply afraid or contemptuous (or both).


    .... or those involved in implementing the Linux kernel consider C to
    be the more appropriate tool. The fact that C and its ABI is pretty
    stable since ages and that GCC's C compiler is less buggy than GCC's
    C++ compiler also adds to the reasons in favor of C. Although I would
    prefer to use C++ as a language, I can agree with many of the reasons
    people have for using C. Of course, I also disagree with at least
    some reasons given in favor of C.
    --
    <mailto:> <http://www.dietmar-kuehl.de/>
    <http://www.eai-systems.com> - Efficient Artificial Intelligence
    Dietmar Kuehl, Mar 4, 2006
    #10
  11. wilberX

    Jim Langston Guest

    "BigBrian" <> wrote in message
    news:...
    > Michael Redlich wrote:
    >> Phlip wrote:
    >>
    >> >
    >> > C++ is C with a few keywords added and just a couple bugs removed.
    >> >

    >>
    >> A person graduating from C to C++ has somewhat of a steep
    >> learning curve if he/she wants to develop good, quality code.

    >
    > Your statement sounds like you're infering that C++ is better than C
    > since you suggest that people graduate from C to C++. This really
    > isn't true in every case, both languages have tasks for which each is
    > better than the other. The linux kernel is writen in C, not C++. I
    > would bet most of the developers for the linux kernel would take issue
    > with the statement that they needed to graduate to C++.


    I read an article (web page discussion) about why the linux kernal is still
    in C and not C++. They had looked at implementing it in C++ but new would
    give them many of problems. In a kernal memory is allocated in many
    differnt places, since the kernal is the one that is ultimately responsible
    for allocating the memory that new uses.

    They could of used C++ if they were to limit uses of new, but it was decided
    that since a lot of people work on the kernal that some programmer wouldn't
    be aware of all the limitations and use new where they weren't supposed to
    (or even std templates that use alloc such as std::string) and break things.

    From what I read they would of used C++ for the kernal if they could without
    these problems. So it wasn't a fact of C++ being inferior to C, but the
    fact that wasn't the best language for the use.

    If I program on an AS/400 I'll most likely use RPG (Report Program
    Generator) even though you can get a C or C++ compiler. RPG is not better
    than C or C++, but it is the most appropriate langauge for the use.

    Also, it could be argued that C is a subset of C++, or C++ is a superset of
    C. You can still program a C program in C++ without using any of the C++
    objects or such with minimal changes.

    In my opionion, no langauge is better than any other langauge. Languages
    are designed with specific purposes in mind when they are designed. If they
    are used for that purpose, then they are probably the best langauge for that
    purpose.
    Jim Langston, Mar 4, 2006
    #11
  12. BigBrian wrote:

    > > >

    > >
    > > A person graduating from C to C++ has somewhat of a steep
    > > learning curve if he/she wants to develop good, quality code.

    >
    > Your statement sounds like you're infering that C++ is better than C
    > since you suggest that people graduate from C to C++. This really
    > isn't true in every case, both languages have tasks for which each is
    > better than the other. The linux kernel is writen in C, not C++. I
    > would bet most of the developers for the linux kernel would take issue
    > with the statement that they needed to graduate to C++.
    >


    I don't see how my statement implied that C++ is *better* than C. I
    was merely trying to point out that there is more to learning C++ than
    Philip seemed to make it out to be. Maybe I shouldn't have used the
    term "graduated." It was simply a metaphor for someone who is a C
    developer that is interested in learning C++. I also should have said,
    "good, quality C++ code."

    > >
    > > True, one can essentially create an "object" using the struct
    > > mechanism.

    >
    > True, but that's not enough to support OOP. You also need to implement
    > your own way of handling dynamic binding to support polymorphism.
    >


    I also didn't say that you could *fully* support OOP with C. That's
    why I use C++ and Java...

    That's the problem with these Usenet groups. There's no face-to-face
    interaction, and there's potential for misunderstandings because these
    groups are global. I'm from New Jersey, and you all know how we talk
    over here: "Yea, I'm from Joisey..." :)

    Mike.

    -----
    ACGNJ Java Users Group
    http://www.javasig.org/
    Michael Redlich, Mar 4, 2006
    #12
  13. Jim Langston wrote:
    >
    > In my opionion, no langauge is better than any other langauge. Languages
    > are designed with specific purposes in mind when they are designed. If they
    > are used for that purpose, then they are probably the best langauge for that
    > purpose.


    Amen, brother! I couldn't agree more...

    Mike.

    -----
    ACGNJ Java Users Group
    http://www.javasig.org/
    Michael Redlich, Mar 4, 2006
    #13
  14. wilberX

    Jerry Coffin Guest

    In article <037Of.250$>,
    says...

    [ ... ]

    > In my opionion, no langauge is better than any other langauge. Languages
    > are designed with specific purposes in mind when they are designed. If they
    > are used for that purpose, then they are probably the best langauge for that
    > purpose.


    Obviously you've never tried to use Intercal, UnLambda or
    brainf*(k. Some languages are definitely worse than
    anything that could possibly be considered rational, sane
    or intelligent.

    --
    Later,
    Jerry.

    The universe is a figment of its own imagination.
    Jerry Coffin, Mar 4, 2006
    #14
  15. wilberX

    TB Guest

    Jim Langston skrev:
    <snip>
    >
    > In my opionion, no langauge is better than any other langauge. Languages
    > are designed with specific purposes in mind when they are designed. If they
    > are used for that purpose, then they are probably the best langauge for that
    > purpose.
    >
    >


    Well, most commercial languages are classified as "general-purpose",
    hence lack the fourth generation specialization. But they do have
    different designs that easier promotes the langauges over others in
    certain problem domains (today most obvious on the oop stage).

    --
    TB @ SWEDEN
    TB, Mar 4, 2006
    #15
  16. wilberX

    TB Guest

    (OT) Re: C and C++

    Jerry Coffin skrev:
    > In article <037Of.250$>,
    > says...
    >
    > [ ... ]
    >
    >> In my opionion, no langauge is better than any other langauge. Languages
    >> are designed with specific purposes in mind when they are designed. If they
    >> are used for that purpose, then they are probably the best langauge for that
    >> purpose.

    >
    > Obviously you've never tried to use Intercal, UnLambda or
    > brainf*(k. Some languages are definitely worse than
    > anything that could possibly be considered rational, sane
    > or intelligent.
    >


    You mean "brainfuck".

    Esoteric languages are their own language group with their own purpose,
    just like all pure research languages produced. And UnLambda has some
    very interesting properties that should not be shrugged off as something
    "worse than anything that could possibly be considered rational".

    --
    TB @ SWEDEN
    TB, Mar 4, 2006
    #16
  17. wilberX

    JustBoo Guest

    On Fri, 03 Mar 2006 22:36:33 GMT, "Mike Wahler"
    <> wrote:

    >C++ isn't *only* an OOP language. One can
    >write procedural code with it as well. Both
    >C and C++ can be considered 'general purpose'
    >languages.


    Oooo, boy... :-D

    http://en.wikipedia.org/wiki/Procedural_code

    "In the beginning the Universe was created. This has made a lot of
    people very angry and has been widely regarded as a bad move."
    - Douglas Adams
    JustBoo, Mar 4, 2006
    #17
  18. wilberX

    Phlip Guest

    JustBoo wrote:

    Mike Wahler mkwahler wrote:
    >
    >>C++ isn't *only* an OOP language. One can
    >>write procedural code with it as well. Both
    >>C and C++ can be considered 'general purpose'
    >>languages.


    That's the party line. Let's just say the paradigm that sucks under C++
    least is OOP. ;-)

    > Oooo, boy... :-D
    >
    > http://en.wikipedia.org/wiki/Procedural_code


    The opposite of "procedural" is "event driven". OOP enables that, but it's
    not the opposite of "procedural".

    > "In the beginning the Universe was created. This has made a lot of
    > people very angry and has been widely regarded as a bad move."
    > - Douglas Adams


    How dare you cite holy scripture in a public forum??!

    --
    Phlip
    http://www.greencheese.org/ZeekLand <-- NOT a blog!!!
    Phlip, Mar 4, 2006
    #18
  19. wilberX

    Neil Cerutti Guest

    On 2006-03-04, osmium <> wrote:
    > "wilberX" writes:
    >
    >>How much knowledge of C is
    >> required to understand C++? Thanks.

    >
    > None at all is required. C++ is a complete (albeit irritating) free
    > standing language


    Nearly. You are stuck with the C standard library for certain things,
    and you won't find that library documented in the C++ Standard.

    --
    Neil Cerutti
    Neil Cerutti, Mar 6, 2006
    #19
  20. wilberX

    Ron Natalie Guest

    Phlip wrote:
    > wilberX wrote:
    >
    >> I have a question on how closely C and C++ are related. If i am
    >> correct C++ is OOP while C is not. Now how closely can an OOP language
    >> and a procedural language be related? How much knowledge of C is
    >> required to understand C++? Thanks.

    >
    > To what purpose will you put the answer?
    >
    > C++ is C with a few keywords added and just a couple bugs removed.


    And unfortunately a more than a few bugs propagated.
    Ron Natalie, Mar 8, 2006
    #20
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Nut Cracker
    Replies:
    1
    Views:
    338
  2. jakk
    Replies:
    4
    Views:
    12,112
  3. Tim Meagher
    Replies:
    8
    Views:
    1,288
    Karl Seguin
    Jun 18, 2005
  4. Jerry Manner
    Replies:
    2
    Views:
    6,538
    SpaceGirl
    May 30, 2005
  5. titi

    if and and vs if and,and

    titi, Mar 9, 2007, in forum: VHDL
    Replies:
    4
    Views:
    578
    Mike Treseler
    Mar 11, 2007
Loading...

Share This Page