Thread: To C or not to C

  1. #1
    Registered User
    Join Date
    Jul 2002

    To C or not to C

    I see all the debate about which code to use so here's my 2 cents worth.

    I have been programming since the machine code days. My forte is speed.
    I drifted away from assembly about 10 years ago because the compilers got
    so good and the processors got more complicated.

    I have just spent 6 months learning JAVA. It's ok but I miss pointers!
    Have you ever tried to have 100 threads running in JAVA? It worked in
    jdk1.3.1 but got slower in 1.3.1_03 and even slower in 1.4.0_01.

    C++ is also ok but it does too many things that I didn't ask it to.

    If you really want to know what your code is doing I like C.

    Be aware that you can break the operating system with C by straying out
    side of legal memory or by not unallocating reserved memory. All these
    problems are solved with good code.

    Of course if you don't care about a milli second here and there and you want
    portability C++ or JAVA will do.

    Whatever you're comfortable with.

  2. #2
    Addicted to the Internet netboy's Avatar
    Join Date
    Dec 2001
    I'm not too sure about programming languages as I'm still a very early beginner... I write in C and VB only for now...

    But I did heard from many sources that C is the easiet language of all... isn't it?
    It's unfulfilled dreams that keep you alive.


  3. #3
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Waterloo, Texas
    I will partially agree with you there, Jerry. C is like a toolbox of raw materials: You can build wonderfully fast programs and the bonus is that you know exactly what went into them. C++ is a bit more like having a toolbox of neat gadgets: You can still build those fast programs, but you are not 100% positive what's inside those gadgets, (often leading to some strange side effects!).
    But C++ is a natural extension of C. In C, some aspects of programming can become tedious such as instantiation, initialization, and yes, garbage collection! On the other hand, look at C++, with a simple base class and continuing onward, one can easily build almost self-assembling objects! (Can you tell which side of the fence I"M on?)

    Let me give you just a simple example. The other day, I said to myself "I really need an object that will grab program settings from a text file so that I don't have to re-compile each time I tweak a single variable". Now, of course, in C, this is not only possible, but quite trivial. But the class that I ended up writing was so seamless that had I been asked to do it in straight C, I would have preferred not to! Just look:

    int main()
     ProgramSettings get("settings.txt");
     int count = get.Int("count:");
     char *title = get.NewString("title:");
     float mantissa = get.Float("mantissa:");
     return 0;
    }                   //...variable "get" automatically shuts down and cleans up
    The beauty of this object is that I can "take it anywhere" and reuse it constantly, with so little hassle! I would dare you to write a simpler one in straight C!
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
        return std::pow
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;

  4. #4
    Banned borko_b's Avatar
    Join Date
    Jun 2002
    Well... I live in Bulgaria :)
    Well i think that C will be a programing language of a choise
    especially in lower level of programing...

    there are C compilers written specificaly for programing chips...
    and C code mixed with some inline assembly is great for doing such tasks

    (Although that in this arrea C is competing with HLA)

    So C language will still be on the scene ...
    there are numerous tasks in which OOP will fail to deliver speed

  5. #5
    Registered User
    Join Date
    May 2002
    Spend time on other issues instead debate over and
    over between C and C++. Use your SEARCH tool for
    your related question.

Popular pages Recent additions subscribe to a feed