Breaking Eggs And Making Omelettes

Topics On Multimedia Technology and Reverse Engineering


Archives:

Linus Is Still The Man

October 1st, 2007 by Multimedia Mike

Linus Torvalds– a legendary figure who sat down one day and wrote an operating system. To many ordinary programmers like myself, he is a distant figurehead, difficult to comprehend. Every now and then, however, we catch a glimpse that helps us to humanize the mighty coder. And I don’t know about you, but I love a good knockdown, drag-em-out C vs. C++/Java/OOP flame war and this thread does not disappoint: Linus tells it like it is on the topic of C++.

Perhaps I’m too harsh on C++. In fact, there is one instance where I really appreciate the use of good, solid C++ coding– when a binary target that I wish to reverse engineer was originally authored in C++, compiled, and still has the mangled C++ symbols. gcc’s binutils do a fabulous job of recovering the original class and method names, as well as argument lists.

Sometimes I think I should get off my high horse with regards to C. After all, this article from May listed C programming as one of the top 10 dead or dying computer skills, right up there with Cobol and OS/2. This is not the first time that I have encountered such sentiment, that C is going the way of raw assembler. I think it’s all a conspiracy perpetrated by the computer book publishing industry. The C language simply does not move anywhere near as many books as the latest flavor of the month fad language.

Posted in Programming, Reverse Engineering | 6 Comments »

6 Responses

  1. Reimar Says:

    Currently I can’t see how C _could_ go away. Hardly any of the other languages (esp. Java, Mono etc.) provide a way to directly talk to the OS, so you either have to stick with what the designers thought that you might want to do or you have to write a C program to do it and in addition a wrapper for your preferred language.
    If you want to experience the real pain, just try to write a cross-platform Gui program that can use RS232 (yes, this is still very important around here in the production industry).
    You can use .Net with Winforms, but then mono will mess up the layout and it is unusable on Linux.
    Or you can use GTK#, but since the RS232 stuff needs .Net 2.0 it won’t run on Windows unless you install mono there as well (GTK# for .Net is only for 1.1).
    Or you use Java. Then you have to install the RS232 stuff manually on the system. In addition, you have the choice between v2.0 of their RS232 API that is only supported for Solaris and Windows or v3.0 that is only Solaris and Linux. Or you use a third-party one that is Linux and Windows – but no Solaris or OSX.
    So what seems to be left is GTK + C if you don’t need native OSX or QT4 + C++ if you have either money left over or want it to be GPL.
    And now someone tell me why that guy on the Intel Multicore discussion said that Gui development and tools were a solved problem…

  2. Adam Ehlers Nyholm Thomsen Says:

    Actually I like one thing from C++ and that’s that I’m allowed to do:
    for(int i=0; i

  3. Reimar Says:

    Uh, Borland compilers had that quite some time ago, and even gcc gives you a friendly
    > error: ‘for’ loop initial declaration used outside C99 mode
    which means it works fine with –std=c99.
    But I honestly prefer portability to non-complete-C99 compilers over a bit of syntactic sugar.

  4. Multimedia Mike Says:

    If you need arbitrary variable declarations in a C compiler that does not strictly support it, you can fall back on the time-honored method that MPlayer uses: Declare random scopes as necessary.

    :-)

  5. Reimar Says:

    Which is a good argument why C like Pascal should have supported variable declarations only at the top of functions.
    Then at least we wouldn’t have had a 3000-line main() function in MPlayer but instead something nicely split ;-)

  6. Ajay Says:

    May I recommend D for those who want to use a modern language that is comparable in performance to C? Also, you can avoid some of the headaches of C++ and get some even more modern features.