Announcement

Collapse
No announcement yet.

The Future of Compiz In Question

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

  • elanthis
    replied
    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!

    Leave a comment:


  • Ze..
    replied
    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).

    Leave a comment:


  • energyman
    replied
    and how many headers do you have to include in your c app?

    Leave a comment:


  • curaga
    replied
    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?

    Leave a comment:


  • elanthis
    replied
    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.

    Leave a comment:


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

    Leave a comment:


  • spykes
    replied
    And Objective C ?

    Leave a comment:


  • energyman
    replied
    because python is dead slow - and not everybody likes forced formatting?

    Leave a comment:


  • spykes
    replied
    If you want oo - why not use an oo language in the first place ?
    What about python instead of C++ then ?
    Let the core program being written in C, and do the UI design using Python.

    Anyway, I don't think that the size of Glib and/or bad code has something to do with the language itself.
    It's as easy (if not easier) to write crap using C++.

    Leave a comment:


  • energyman
    replied
    Originally posted by yesterday View Post
    Well I am a CS student who really likes C -- OK I guess I can see what you mean buy a true OO language being more suitable for GUI type/desktop work, but IIRC most of GNOME is in C, so I guess it's not total insanity is it?

    Also, I don't believe lack of competence should be a reason to move to another language. Poor C coders will likely make for poor Java coders or Python coders for non-trivial and non-toy applications. Surely a poor C coder will make a poor C++ coder as well. There is definitely a place for languages that make things easier, but I don't think the rationale should be to encourage poor coders to get involved in a project.
    yes, gnome is written in C because 'more people know C' - and they jump to a lot of hoops to implement OO in C. That alone explains some of the size and uglyness of glib and gtk. It is pretty much a mess.

    If you want oo - why not use an oo language in the first place?

    Leave a comment:

Working...
X