Linux programming, is there any C++?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?iso-8859-1?q?Tom=E1s_=D3_h=C9ilidhe?=

    Linux programming, is there any C++?


    I'm kind of new to Linux and I've started downloading applications and
    installing them. Applications are distributed as source code in a
    ".tar.gz" file. You unzip the file, navigate to the directory, run
    "configure" , then run "make", then run "make install".

    Anyway, in all the programs I've seen, there's only ever been .c files, and
    it looks like only gcc has been invoked. Do people in the Linux community
    not use C++ and distribute their source in ".tar.gz"?

    --
    Tomás Ó hÉilidhe
  • Rolf Magnus

    #2
    Re: Linux programming, is there any C++?

    Tomás Ó hÉilidhe wrote:

    I'm kind of new to Linux and I've started downloading applications and
    installing them. Applications are distributed as source code in a
    ".tar.gz" file. You unzip the file, navigate to the directory, run
    "configure" , then run "make", then run "make install".
    >
    Anyway, in all the programs I've seen, there's only ever been .c files,
    and it looks like only gcc has been invoked. Do people in the Linux
    community not use C++ and distribute their source in ".tar.gz"?
    They do. Many libraries are written in C, so they can be easier used with
    other languages.

    Comment

    • Roland Pibinger

      #3
      Re: Linux programming, is there any C++?

      On Sat, 16 Feb 2008 16:09:27 GMT,
      "=?iso-8859-1?q?Tom=E1s_=D3 _h=C9ilidhe?=" wrote:
      >Do people in the Linux community
      >not use C++ and distribute their source in ".tar.gz"?
      C++ never had much weight in the Unix world because it violates the
      basic Unix philosophy:



      --
      Roland Pibinger
      "The best software is simple, elegant, and full of drama" - Grady Booch

      Comment

      • Jeff Schwab

        #4
        Re: Linux programming, is there any C++?

        Tomás Ó hÉilidhe wrote:
        I'm kind of new to Linux and I've started downloading applications and
        installing them. Applications are distributed as source code in a
        ".tar.gz" file. You unzip the file, navigate to the directory, run
        "configure" , then run "make", then run "make install".
        >
        Anyway, in all the programs I've seen, there's only ever been .c files, and
        it looks like only gcc has been invoked. Do people in the Linux community
        not use C++ and distribute their source in ".tar.gz"?
        C and Unix have a lot of history together. C was invented specifically
        to write Unix, and remains the lingua franca for linking object files
        compiled from different source languages.

        Comment

        • Jeff Schwab

          #5
          Re: Linux programming, is there any C++?

          Roland Pibinger wrote:
          On Sat, 16 Feb 2008 16:09:27 GMT,
          "=?iso-8859-1?q?Tom=E1s_=D3 _h=C9ilidhe?=" wrote:
          >Do people in the Linux community
          >not use C++ and distribute their source in ".tar.gz"?
          >
          C++ never had much weight in the Unix world because it violates the
          basic Unix philosophy:
          http://www.catb.org/~esr/writings/ta...l/ch01s07.html
          I don't think C++ violates KISS. C++ is certainly a more complicated
          language than C, but that does not imply that applications will be
          correspondingly more complex; in fact, the reverse seems to be true most
          of the time. C++ provides language features that help keep client code
          simple.

          C++ happened to hit the scene a little later than C, but was developed
          at Bell Labs mainly for use on Unix. Plenty of modern Unix applications
          are written in C++, including those developed by Unix industry
          consortia. Dominant desktop environments, including CDE and KDE, are
          written in C++. Some of the most popular languages used on Unix servers
          today, including Java and Ruby, are written in a sort of hybrid between
          C and C++.

          I personally love both Unix and C++. I use C for device drivers, but
          prefer C++ for user-space applications. What's great about C is that
          the language is so simple (for the amount of power it gives you) that it
          is often the first HLL for which compilers are available on new
          platforms. What's great about C++ is that it plays well with very
          low-level code, but provides excellent support for arbitrarily
          high-level abstractions.

          Comment

          • Ian Collins

            #6
            Re: Linux programming, is there any C++?

            Jeff Schwab wrote:
            >
            I personally love both Unix and C++. I use C for device drivers, but
            prefer C++ for user-space applications.
            Why make that distinction? Provided you avoid language features that
            require run time support, C++ is an excellent language for drivers.

            --
            Ian Collins.

            Comment

            • Phil Endecott

              #7
              Re: Linux programming, is there any C++?

              Tomás Ó hÉilidhe wrote:
              I'm kind of new to Linux and I've started downloading applications and
              installing them. Applications are distributed as source code in a
              ".tar.gz" file. You unzip the file, navigate to the directory, run
              "configure" , then run "make", then run "make install".
              >
              Anyway, in all the programs I've seen, there's only ever been .c files, and
              it looks like only gcc has been invoked. Do people in the Linux community
              not use C++ and distribute their source in ".tar.gz"?
              Go to freshmeat.net, click "browse", then "programmin g language" under
              "browse by" [at this point you'll notice that it reports ~8000 C
              projects and ~4000 C++ projects], click C++, then "pick a filter to
              add", "operating system :: POSIX :: linux". (Note that much so-called
              Linux software will actually run on many platforms, so it may not be
              catalogued as precisely as the Linux category here.)

              Most peculiarly, the first item in the results is the Linux kernel!
              Someone is having a joke there... Then you'll see the expected projects
              like OpenOffice and a few thousand more.


              Phil.

              Comment

              • Ian Collins

                #8
                Re: Linux programming, is there any C++?

                Jeff Schwab wrote:
                Ian Collins wrote:
                >Jeff Schwab wrote:
                >>I personally love both Unix and C++. I use C for device drivers, but
                >>prefer C++ for user-space applications.
                >>
                >Why make that distinction? Provided you avoid language features that
                >require run time support, C++ is an excellent language for drivers.
                >
                If I ever gave a client a Unix device driver written in C++, I'd be told
                to re-write it. (I know this for a face, since I've suggested it.) The
                problem is that the overwhelming majority of people who professionally
                write Unix device drivers are far more comfortable with C then C++, so
                maintenance of a C++ driver on Unix is potentially much more expensive.
                >
                Fair enough, I've only ever had to supply binary drivers. A large
                proportion of C drivers I've seen (especially NIC drivers) tend to be
                written in pseudo OO C.

                --
                Ian Collins.

                Comment

                • Jeff Schwab

                  #9
                  Re: Linux programming, is there any C++?

                  Ian Collins wrote:
                  Jeff Schwab wrote:
                  >Ian Collins wrote:
                  >>Jeff Schwab wrote:
                  >>>I personally love both Unix and C++. I use C for device drivers, but
                  >>>prefer C++ for user-space applications.
                  >>Why make that distinction? Provided you avoid language features that
                  >>require run time support, C++ is an excellent language for drivers.
                  >If I ever gave a client a Unix device driver written in C++, I'd be told
                  >to re-write it. (I know this for a face, since I've suggested it.) The
                  >problem is that the overwhelming majority of people who professionally
                  >write Unix device drivers are far more comfortable with C then C++, so
                  >maintenance of a C++ driver on Unix is potentially much more expensive.
                  >>
                  Fair enough, I've only ever had to supply binary drivers. A large
                  proportion of C drivers I've seen (especially NIC drivers) tend to be
                  written in pseudo OO C.
                  Yep. Have you seen the C-language object model used by the BSD kernel?
                  There's so much preprocessor magic, it's almost like learning a new
                  language. It's hard to believe that it wouldn't be easier just to make
                  the jump to C++.


                  Comment

                  • Matthias Buelow

                    #10
                    Re: Linux programming, is there any C++?

                    Jeff Schwab wrote:
                    but provides excellent support for arbitrarily high-level abstractions.
                    ^^^^^^^^^^^^^^^ ^^^^^^^

                    Please elaborate.

                    Comment

                    • peter koch

                      #11
                      Re: Linux programming, is there any C++?

                      On 18 Feb., 18:58, Matthias Buelow <m...@incubus.d ewrote:
                      Jeff Schwab wrote:
                      but provides excellent support for arbitrarily high-level abstractions.
                      >
                                                           ^^^^^^^^^^^^^^^ ^^^^^^^
                      >
                      Please elaborate.
                      Jeff would have to respond to the "arbitraril y" part, but just take a
                      look at e.g. the boost or the standard C++ library, where quite
                      complex constructs exist to make life simple for the developer.
                      For one example, there's all the collections in the standard library
                      together with the algorithms give a quite rich environment to work in.
                      Another example is a library such as Blitz, that allows numerical code
                      to be written in a notation that corresponds almost perfectly to the
                      matematical one, but still gives optimal performance.
                      My third and last example is spirit that allows you to write parsers
                      directly in the source code, describing the language in something that
                      is very close to BNF.

                      /Peter

                      Comment

                      • Matthias Buelow

                        #12
                        Re: Linux programming, is there any C++?

                        James Kanze wrote:
                        the
                        time invested in doing so is paid back enormously in increased
                        productivity.
                        Hmm. Actually, I was a lot more productive in C than I am now in C++
                        (which I do for money). I also have been more productive with the C++ of
                        15 years ago. This is unsurprising. In trying to fix the language, it
                        gets more and more broken, piling workaround upon workaround, making it
                        a discombombulate d mess that is exceptionally hard to use and boggles
                        the mind with every new detail investigated. I don't think the language
                        can be fixed at all. Best to bury it in a quiet part of the garden.
                        Anyway, back to programming.

                        Comment

                        • Jeff Schwab

                          #13
                          Re: Linux programming, is there any C++?

                          Matthias Buelow wrote:
                          James Kanze wrote:
                          >
                          >the
                          >time invested in doing so is paid back enormously in increased
                          >productivity .
                          >
                          Hmm. Actually, I was a lot more productive in C than I am now in C++
                          (which I do for money). I also have been more productive with the C++ of
                          15 years ago.
                          What is it that you could do then, that you can't feasibly do now? I
                          believe what you're saying, but I'm curious what "broke" for you.

                          Comment

                          • Matthias Buelow

                            #14
                            Re: Linux programming, is there any C++?

                            Jeff Schwab wrote:
                            What is it that you could do then, that you can't feasibly do now? I
                            believe what you're saying, but I'm curious what "broke" for you.
                            One example is running into error messages like:

                            blah.h:13: error: conversion from '<unresolved overloaded function type>' t
                            o non-scalar type '__gnu_cxx::__n ormal_iterator< foo*, std::vector<foo ,
                            std::allo
                            cator<foo >' requested

                            is what makes it so slow and frustrating. Too many WTFs/minute. At least
                            gcc produces enormous output, often barely intelligible, for really
                            minor offences. Templates have really obfuscated the type system.
                            (Actually, the above error message is relatively harmless still, I just
                            couldn't find something worse off-hand.) Of course one learns to
                            recognize certain patterns but sometimes it's still too much
                            head-scratching before one knows what's going wrong.

                            Another thing is debugging. I know my way around with gdb fairly well,
                            so that isn't the problem. The problem is the combination of: an
                            obfuscating static type system (see above), too little runtime
                            information about said type system, combined with manual memory
                            managment in (real-life) programs that do not necessarily follow
                            bandaid-principles like RAII, in programs that are often event-driven
                            (like modern GUI applications) are. Sensory overload, coredump.
                            A dynamic language with good runtime support and automatic memory
                            management would be a big improvement here (I'm not talking about
                            Java/C#. Maybe Objective-C, never used it but it looks promising at
                            first glance. Maybe a modern version of Lisp. Or something Smalltalky.
                            Things like these.)

                            Comment

                            • Linonut

                              #15
                              Re: Linux programming, is there any C++?

                              * Tomás Ó hÉilidhe peremptorily fired off this memo:
                              >
                              I'm kind of new to Linux and I've started downloading applications and
                              installing them. Applications are distributed as source code in a
                              ".tar.gz" file. You unzip the file, navigate to the directory, run
                              "configure" , then run "make", then run "make install".
                              >
                              Anyway, in all the programs I've seen, there's only ever been .c files, and
                              it looks like only gcc has been invoked. Do people in the Linux community
                              not use C++ and distribute their source in ".tar.gz"?
                              fluxbox (the window manager) is one C++ project.

                              There are many others.

                              --
                              Tardiness often robs us opportunity, and the dispatch of our forces.
                              -- Niccolo Machiavelli

                              Comment

                              Working...