Why ! C++

Discussion in 'C++' started by lakshmi, Mar 1, 2007.

  1. lakshmi

    lakshmi Guest

    Hi all,
    We mostly use C for system programming.
    Why not C++?
    Since c++ is superset of C.
    we can combine both if needed...
    do we have any file system written in C++.
    Thx.
    lakshmi, Mar 1, 2007
    #1
    1. Advertising

  2. lakshmi

    Sarath Guest

    On Mar 1, 8:38 pm, "lakshmi" <> wrote:
    > Hi all,
    > We mostly use C for system programming.
    > Why not C++?
    > Since c++ is superset of C.
    > we can combine both if needed...
    > do we have any file system written in C++.
    > Thx.


    Why we can't develop a file system in C++. I think it is possible even
    if I dint implement the same.
    C++ really comes in the commercial software industry which need more
    flexibilty, re-usability, data security and the power of C++ is really
    superb. I too was a supporter of C when I was studying. But when I
    started working, i realized that it is possible to express real world
    problems using C++ pretty well in manner. It also has a powerful
    standard library and also supports generic programming. It solely
    depends on the system, complexity, performance and many other factors
    decides to choose between programming languages.
    Sarath, Mar 1, 2007
    #2
    1. Advertising

  3. lakshmi wrote:
    > Hi all,
    > We mostly use C for system programming.
    > Why not C++?
    > Since c++ is superset of C.
    > we can combine both if needed...
    > do we have any file system written in C++.
    > Thx.
    >


    The Fiasco microkernel has been written in C++ - take a look at it:
    http://www.inf.tu-dresden.de/index.php?node_id=1435&ln=en

    Bjoern
    Bjoern Doebel, Mar 1, 2007
    #3
  4. Bjoern Doebel wrote:
    > lakshmi wrote:
    >
    >>Hi all,
    >>We mostly use C for system programming.
    >>Why not C++?
    >>Since c++ is superset of C.
    >>we can combine both if needed...
    >>do we have any file system written in C++.
    >>Thx.
    >>

    >
    >
    > The Fiasco microkernel has been written in C++ - take a look at it:
    > http://www.inf.tu-dresden.de/index.php?node_id=1435&ln=en
    >
    > Bjoern


    Great name! Does it mean something different in German than in English?
    I hope not.

    john
    John Harrison, Mar 1, 2007
    #4
  5. lakshmi

    mlimber Guest

    On Mar 1, 6:38 am, "lakshmi" <> wrote:
    > Since c++ is superset of C.


    Not strictly speaking. The standard libraries and keywords of each
    have diverged a bit between the current versions of each (though C++0x
    will try to remedy some of that).

    See the Creator's FAQ:

    http://www.research.att.com/~bs/bs_faq.html#C-is-subset

    Cheers! --M
    mlimber, Mar 1, 2007
    #5
  6. lakshmi

    Rolf Magnus Guest

    John Harrison wrote:

    > Bjoern Doebel wrote:
    >> lakshmi wrote:
    >>
    >>>Hi all,
    >>>We mostly use C for system programming.
    >>>Why not C++?
    >>>Since c++ is superset of C.
    >>>we can combine both if needed...
    >>>do we have any file system written in C++.
    >>>Thx.
    >>>

    >>
    >>
    >> The Fiasco microkernel has been written in C++ - take a look at it:
    >> http://www.inf.tu-dresden.de/index.php?node_id=1435&ln=en
    >>
    >> Bjoern

    >
    > Great name! Does it mean something different in German than in English?
    > I hope not.


    This is actually addressed in the FAQ:

    http://os.inf.tu-dresden.de/fiasco/faq.html#2900
    Rolf Magnus, Mar 1, 2007
    #6
  7. lakshmi

    lakshmi Guest

    Thanks you people ...for valuable info
    thanks for the links ...
    On Mar 2, 4:19 am, Rolf Magnus <> wrote:
    > John Harrison wrote:
    > > Bjoern Doebel wrote:
    > >> lakshmi wrote:

    >
    > >>>Hi all,
    > >>>We mostly use C for system programming.
    > >>>Why not C++?
    > >>>Since c++ is superset of C.
    > >>>we can combine both if needed...
    > >>>do we have any file system written in C++.
    > >>>Thx.

    >
    > >> The Fiasco microkernel has been written in C++ - take a look at it:
    > >>http://www.inf.tu-dresden.de/index.php?node_id=1435&ln=en

    >
    > >> Bjoern

    >
    > > Great name! Does it mean something different in German than in English?
    > > I hope not.

    >
    > This is actually addressed in the FAQ:
    >
    > http://os.inf.tu-dresden.de/fiasco/faq.html#2900
    lakshmi, Mar 2, 2007
    #7
  8. "lakshmi" <> wrote in message
    news:...
    : Hi all,
    : We mostly use C for system programming.
    : Why not C++?
    Mainly historical reasons. It is easier to find a C expert
    than a C++ expert in this application domain.

    : Since c++ is superset of C.
    well... mostly.

    : we can combine both if needed...
    : do we have any file system written in C++.
    The Haiku-OS (an open source reimplementation of BeOS)
    has re-implemented the complete file system in C++:
    http://haiku-os.org/

    hth -Ivan
    --
    http://ivan.vecerina.com/contact/?subject=NG_POST <- email contact form
    Brainbench MVP for C++ <> http://www.brainbench.com
    Ivan Vecerina, Mar 2, 2007
    #8
  9. On 1 Mar 2007 03:38:24 -0800, "lakshmi" wrote:
    >We mostly use C for system programming.
    >Why not C++?


    Because C is the only portable system programming language available?
    C++ is not appropriate for system programming.

    >Since c++ is superset of C.
    >we can combine both if needed...


    That was the original idea of the C++ inventor. Do piecemeal injection
    of C++ into C code until C becomes extinct. It didn't work.

    >do we have any file system written in C++.


    Why would you want to have one?

    Best wishes,
    Roland Pibinger
    Roland Pibinger, Mar 2, 2007
    #9
  10. lakshmi

    lakshmi Guest

    On Mar 2, 4:31 pm, (Roland Pibinger) wrote:
    > On 1 Mar 2007 03:38:24 -0800, "lakshmi" wrote:
    >
    > >We mostly use C for system programming.
    > >Why not C++?

    >
    > Because C is the only portable system programming language available?
    > C++ is not appropriate for system programming.
    >
    > >Since c++ is superset of C.
    > >we can combine both if needed...

    >
    > That was the original idea of the C++ inventor. Do piecemeal injection
    > of C++ into C code until C becomes extinct. It didn't work.
    >
    > >do we have any file system written in C++.

    >
    > Why would you want to have one?
    >
    > Best wishes,
    > Roland Pibinger


    yes..i would like to do that....
    you think a file system in c++ will be as successful like the one
    written in C?
    lakshmi, Mar 2, 2007
    #10
  11. lakshmi

    Rolf Magnus Guest

    Roland Pibinger wrote:

    > On 1 Mar 2007 03:38:24 -0800, "lakshmi" wrote:
    >>We mostly use C for system programming.
    >>Why not C++?

    >
    > Because C is the only portable system programming language available?


    Who told you that?

    > C++ is not appropriate for system programming.


    It isn't?
    Rolf Magnus, Mar 2, 2007
    #11
  12. lakshmi

    mlimber Guest

    On Mar 2, 6:31 am, (Roland Pibinger) wrote:
    > On 1 Mar 2007 03:38:24 -0800, "lakshmi" wrote:
    >
    > >We mostly use C for system programming.
    > >Why not C++?

    >
    > Because C is the only portable system programming language available?


    C is certainly more portable because it is more simplistic and because
    compiler/library vendors have not kept up with the C++ Standard in
    short order. Then again, when you're doing systems programming, it's
    often platform-specific and not something you port elsewhere. What one
    should favor in a language for systems programming is power and speed,
    not portability, and C++ does quite well on those compared to C.

    > C++ is not appropriate for system programming.


    That's not what the Creator says:

    http://www.research.att.com/~bs/bs_faq.html#whyC

    Cheers! --M
    mlimber, Mar 2, 2007
    #12
  13. On Fri, 02 Mar 2007 14:33:33 +0100, Rolf Magnus wrote:
    >Roland Pibinger wrote:
    >> C++ is not appropriate for system programming.

    >
    >It isn't?


    Which 'systems' are written in C++?
    Roland Pibinger, Mar 2, 2007
    #13
  14. lakshmi

    Lionel B Guest

    On Fri, 02 Mar 2007 11:31:33 +0000, Roland Pibinger wrote:

    > On 1 Mar 2007 03:38:24 -0800, "lakshmi" wrote:
    >>We mostly use C for system programming.
    >>Why not C++?

    >
    > Because C is the only portable system programming language available?
    > C++ is not appropriate for system programming.
    >
    >>Since c++ is superset of C.
    >>we can combine both if needed...

    >
    > That was the original idea of the C++ inventor. Do piecemeal injection
    > of C++ into C code until C becomes extinct. It didn't work.


    Please don't feed the troll.

    --
    Lionel B
    Lionel B, Mar 2, 2007
    #14
  15. lakshmi

    Rolf Magnus Guest

    Roland Pibinger wrote:

    > On Fri, 02 Mar 2007 14:33:33 +0100, Rolf Magnus wrote:
    >>Roland Pibinger wrote:
    >>> C++ is not appropriate for system programming.

    >>
    >>It isn't?

    >
    > Which 'systems' are written in C++?


    I don't know. Why do you ask?
    Rolf Magnus, Mar 2, 2007
    #15
  16. lakshmi

    dervaish Guest

    On Mar 1, 4:38 pm, "lakshmi" <> wrote:
    > Hi all,
    > We mostly use C for system programming.
    > Why not C++?

    You can use C++ also but C++ has many other design issue like OOP
    through which you can understand the power of C++ language. Other
    being the historic reason as many lines of code(may be millions) is
    written in C, so if you want to add something to it, then C is
    preferred. Also some basic code structure for system programming is
    already written in C, so just have to copy it and then proceed to
    specialized part of your system's program.
    > Since c++ is superset of C.
    > we can combine both if needed...

    But don't ever do that as then code maintaining ability would be at
    lost. May be for 1000 lines code it would not show but once code is
    expanded, you might have several serious problem and it is always
    better to one programming language and focus on its issue if one
    really wants to exploit the features of programming language.
    > do we have any file system written in C++.
    > Thx.
    dervaish, Mar 3, 2007
    #16
  17. lakshmi

    Zara Guest

    On 1 Mar 2007 03:38:24 -0800, "lakshmi" <>
    wrote:

    >Hi all,
    >We mostly use C for system programming.
    >Why not C++?
    >Since c++ is superset of C.
    >we can combine both if needed...
    >do we have any file system written in C++.


    There are some systems written in C++. I am working on an embeddded
    one that is comprised of a couple of thousand lines of C++ plus a
    hundred lines of assembler, plus 0 (zero) lines of C.

    Zara
    Zara, Mar 5, 2007
    #17
  18. lakshmi

    SasQ Guest

    Dnia Mon, 05 Mar 2007 08:15:19 +0100, Zara napisa³(a):

    > There are some systems written in C++. I am working on
    > an embeddded one that is comprised of a couple of
    > thousand lines of C++ plus a hundred lines of assembler,
    > plus 0 (zero) lines of C.


    How did you make it?
    How can C++ work in an embedded system?
    I thaught C++ needs some additional implementation code,
    which make base for C++ language facilities before it
    call main() function. I mean the things like reserving
    static memory, calling constructors for static objects,
    exception handling mechanisms etc. And I thaught that
    new and delete operators have to be implemented using
    some system API/kernel calls to some system memory
    manager, and cannot work in "blank" environment without
    some system/kernel, which may do the memory management
    for new/delete implementation code.
    So how it's been done? I'm very curious about that,
    because the plain old C doesn't need any runtime
    support AFAIK.

    --
    SasQ
    SasQ, Mar 5, 2007
    #18
  19. SasQ a écrit :
    > Dnia Mon, 05 Mar 2007 08:15:19 +0100, Zara napisa³(a):
    >
    >> There are some systems written in C++. I am working on
    >> an embeddded one that is comprised of a couple of
    >> thousand lines of C++ plus a hundred lines of assembler,
    >> plus 0 (zero) lines of C.

    >
    > How did you make it?
    > How can C++ work in an embedded system?
    > I thaught C++ needs some additional implementation code,
    > which make base for C++ language facilities before it
    > call main() function.

    A lot of thing happens before main and even before static initialisation.
    You have to inititialize your processor, your stack (if you have one)
    and other stuff (like disabling this damned watchdog if you have a long
    boot time).

    > I mean the things like reserving static memory,

    This is just a matter of knowing where to put it in the memory area.

    > calling constructors for static objects,

    nothing magic in that, in the same way you initialize object with raw
    memory: new(memory_ptr) object();.
    But in fact this stage is handled by the compiler.

    > exception handling mechanisms etc.

    This is a compiler question.

    > And I thaught that
    > new and delete operators have to be implemented using
    > some system API/kernel calls to some system memory
    > manager, and cannot work in "blank" environment without
    > some system/kernel, which may do the memory management
    > for new/delete implementation code.


    The same way you would do it in C though C++ has a mixed position about
    dynamic allocation, you cannot redefine completly new and delete (thanks
    godness).

    "C programmers think memory management is too important to be left to
    the computer. Lisp programmers think memory management is too important
    to be left to the user."

    (from Ellis and Stroustrup's The Annotated C++ Reference Manual)


    > So how it's been done? I'm very curious about that,
    > because the plain old C doesn't need any runtime
    > support AFAIK.


    You mean it doesn't provide a way to call code before main ?

    Michael
    Michael DOUBEZ, Mar 6, 2007
    #19
  20. lakshmi

    Zara Guest

    On Mon, 05 Mar 2007 21:03:54 +0100, SasQ <> wrote:

    >Dnia Mon, 05 Mar 2007 08:15:19 +0100, Zara napisa?(a):
    >
    >> There are some systems written in C++. I am working on
    >> an embeddded one that is comprised of a couple of
    >> thousand lines of C++ plus a hundred lines of assembler,
    >> plus 0 (zero) lines of C.

    >
    >How did you make it?
    >How can C++ work in an embedded system?
    >I thaught C++ needs some additional implementation code,
    >which make base for C++ language facilities before it
    >call main() function. I mean the things like reserving
    >static memory,

    It is handled by the compiler

    > calling constructors for static objects,
    >exception handling mechanisms

    Oh , sorry. I turned off exceptions. This is the only point I escape
    from Std C++
    > etc. And I thaught that
    >new and delete operators have to be implemented using
    >some system API/kernel calls to some system memory
    >manager,

    I wrote it myself, using C++. Not so difficult

    > and cannot work in "blank" environment without
    >some system/kernel, which may do the memory management
    >for new/delete implementation code.

    See above

    >So how it's been done? I'm very curious about that,
    >because the plain old C doesn't need any runtime
    >support AFAIK.

    What about malloc/reee/realloc? But you may also write them yourself.

    Regards,

    Zara
    Zara, Mar 6, 2007
    #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. =?Utf-8?B?VGltOjouLg==?=

    Why, why, why???

    =?Utf-8?B?VGltOjouLg==?=, Jan 27, 2005, in forum: ASP .Net
    Replies:
    6
    Views:
    568
    Juan T. Llibre
    Jan 27, 2005
  2. Horace Nunley

    why why why does function not work

    Horace Nunley, Sep 27, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    458
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Sep 27, 2006
  3. Mr. SweatyFinger

    VWD why why why

    Mr. SweatyFinger, Nov 28, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    384
    =?Utf-8?B?Q2lhcmFuIE8nJycnRG9ubmVsbA==?=
    Dec 21, 2006
  4. Mr. SweatyFinger

    why why why why why

    Mr. SweatyFinger, Nov 28, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    880
    Mark Rae
    Dec 21, 2006
  5. Mr. SweatyFinger
    Replies:
    2
    Views:
    1,850
    Smokey Grindel
    Dec 2, 2006
Loading...

Share This Page