Announcement

Collapse
No announcement yet.

The Future of Compiz In Question

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #41
    And Objective C ?

    Comment


    • #42
      Eww. Please tell what is good in OO. Having to type 10x longer function names just to get anything done clearly affects production rates.

      Comment


      • #43
        Originally posted by curaga View Post
        Eww. Please tell what is good in OO. Having to type 10x longer function names just to get anything done clearly affects production rates.
        What? OO-style languages usually _reduce_ the length of function call code... at absolute worst, it should be almost same as in procedural-style C code. If you're writing OO code in any sane language that's making things much longer than the C equivalent then you're doing something really off the wall.

        That said, Obj-C is probably not the best bet for a low-level component like the X server. It's a relatively dynamic language and incurs a lot of overhead on method calls compared to something like C or C++. (C++ has no additional overhead compared to C for non-virtual method calls, and its implementation of virtual methods is essentially identical to any C code that uses a shared struct of function pointers -- and you can implement any other style of virtual methods in C++ but do it with a shorter and easier calling convention than C would require.)

        Here I was thinking this was 2009 and that irrational fear of anything non-C was long dead.

        Comment


        • #44
          Uhhh... Lets compare.

          C: puts("Hi")
          Java: system.output.println("Hi")
          C++: std:uts("Hi")

          C is leading with 4 chars. The same function in Java is measly 22 chars, and in C++ it's 9 characters. And you were saying about shorter functions?

          Comment


          • #45
            and how many headers do you have to include in your c app?

            Comment


            • #46
              Originally posted by curaga View Post
              Uhhh... Lets compare.

              C: puts("Hi")
              Java: system.output.println("Hi")
              C++: std:uts("Hi")

              C is leading with 4 chars. The same function in Java is measly 22 chars, and in C++ it's 9 characters. And you were saying about shorter functions?
              actually it's puts("Hi") , you don't need the std bit if you put the namespace std; up the top.

              btw that's a trivial example and can easily come up with other trivial examples where c++ wins , just look at operator overloading... matrix3 = 2DMatrixPlus(matrix1,matrix2); versus matrix3=matrix1+matrix2;

              There are something that c++ buys you like templates , much better type safety and streams and it's only getting better with c++0x which adds some nice features.

              Then we've got the fact that the speed arguments for c++ are bullshit.

              A lot of folks use function pointers and structs to emulate objects , then we've got the whole mess with frameworks like GObject.

              The fact is that object oriented code in c++ is more readable than object oriented code in c.

              Yes you can write hard to read c++ but you can also write hard to read c.

              IMHO most arguments against c++ are generally basing their opinion on past compiler support , it's much better now (although the error messages in some cases could be significantly improved).

              Comment


              • #47
                Originally posted by Ze.. View Post
                IMHO most arguments against c++ are generally basing their opinion on past compiler support , it's much better now (although the error messages in some cases could be significantly improved).
                Yeah, C++ on Linux/UNIX has a major stigma thanks to GCC's past with constantly changing language support and its ever-breaking C++ ABI. Those days are thankfully long gone, but the foul taste still lingers in some of the older Linux/UNIX users' mouths.

                The other half of the C++ hatred is just ignorance and obstinence, really. Linus has his famous mailing list post that people keep quoting as reasons to avoid C++ at all costs, despite the fact that his whole argument comes down to "stupid people write stupid code in C++, so C++ must suck!" By his own logic and by his own complaints against much of the contributed kernel code, C must be an even more horrific language than C++.

                C++ isn't the best language for most use-cases, but honestly, here in 2009, I can't think of any reasons to _ever_ prefer C over C++ if you have the choice. And no, language binding modules are not a good reason. Absolutely nothing stops people from writing C modules for Python/Perl/Ruby/whatever in C++. Extern "C" exists for precisely those use cases.

                You don't even need to write your code as OO in C++. C++ is NOT an OOP language, it's a multi-paradigm language. If you just want to use some of C++'s features to make your procedural code easier to read and maintain, go for it!

                Comment


                • #48
                  C++ versus C? I though i was in a thread about Compiz... but as long I'm here

                  IMHO I don't think C, C++ (or whatever other language) is better or more efficient than the other. We all can give 1000+ examples where the one or the other is more compact or better... the thing is it are just tools and we devs just choose the best tool for the job.

                  That said, I prefer C++... just fits my way of thinking better
                  Last edited by tmpdir; 13 January 2009, 04:12 PM.

                  Comment


                  • #49
                    don't forget that Linus talking from a kernel point of view - and C++ isn't that good for kernel work.

                    Comment


                    • #50
                      Originally posted by energyman View Post
                      don't forget that Linus talking from a kernel point of view - and C++ isn't that good for kernel work.
                      Apple uses a large amount of c++ for their systems level code ,so does Microsoft , then we've got the real time OS people that use it , I think it's QNX from memory , although it could be VxWorks.

                      Anybody who says c++ isn't good for kernel level work is a fool who doesn't understand the language. If c++ is bad for kernel level work then so is c.

                      The linux kernel has a huge mess where they try to do object oriented c but it's a horrible kludge. They could make their lives easier by using c++. You can still do the low level bit manipulation with c++, but you can also do higher level things with more checking instead of hacky macros and sacrificing some compile time checking.
                      Originally posted by elanthis View Post
                      The other half of the C++ hatred is just ignorance and obstinence, really. Linus has his famous mailing list post that people keep quoting as reasons to avoid C++ at all costs, despite the fact that his whole argument comes down to "stupid people write stupid code in C++, so C++ must suck!" By his own logic and by his own complaints against much of the contributed kernel code, C must be an even more horrific language than C++.
                      The only useful thing about Linus famous mailing list post on c++ is that the people who use it in an argument make a mockery of themselves.
                      Originally posted by elanthis View Post
                      C++ isn't the best language for most use-cases, but honestly, here in 2009, I can't think of any reasons to _ever_ prefer C over C++ if you have the choice. And no, language binding modules are not a good reason. Absolutely nothing stops people from writing C modules for Python/Perl/Ruby/whatever in C++. Extern "C" exists for precisely those use cases.
                      The thing is for those language bindings , people end up writing extra macros to help them do language bindings and there are language binding generators for c++.
                      Originally posted by elanthis View Post
                      You don't even need to write your code as OO in C++. C++ is NOT an OOP language, it's a multi-paradigm language. If you just want to use some of C++'s features to make your procedural code easier to read and maintain, go for it!
                      That's the sad thing most folks don't think like that.

                      Comment

                      Working...
                      X