C and C++ binaries

This is a discussion on C and C++ binaries within the A Brief History of Cprogramming.com forums, part of the Community Boards category; In embedded systems, software should be 1. very small 2. very fast 3. take very less working memory. At this ...

  1. #1
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,386

    C and C++ binaries

    In embedded systems, software should be

    1. very small
    2. very fast
    3. take very less working memory.

    At this moment C and C++ are the most used languages, sometimes some parts of the software are written in assembly.

    When looking at speed and memory-use I don't think that C and C++ differ a lot. So the main think to look at is size.

    Today I was discussing the performances of C and C++ with some collegues. One collegue told me that it is possible to write C++ code which results in smaller binaries than C. Though I allways thought that C++ would result in large binaries.

    What language would you use when it comes to size?

  2. #2
    S­énior Member
    Join Date
    Jan 2002
    Posts
    982
    Unless you were using one of C++'s more expensive features I don't think there'd be much (if any) difference in the size of the code generated but I don't know how you'd get smaller code from using C++ alone. It would probably depend on how good a job the optimser was doing for a particular compiler, not which language.

    If you knew what you were doing and didn't mind spending the extra time then I'm sure you could use asm to make the code smaller and faster.

  3. #3
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,831
    I have programmed embedded systems for years, (my first "embedded" system was 1983). In that time things have changed a lot, mostly because of the increased capabilities of the chip manufacturers. In the early days it was necessary to write in either machine code or if you were lucky, an assembler. As the chips grew in complexity, more could be squeezed into less silicon, so you could afford a little overhead if it cut development time, and made maintenance easier. Today, we can embed a machine with a full multitasking OS, and write complex, multithreaded, fully object oriented programs.

    Bottom line, these days, the chips have so much on them, they are not the limiting factor, time to market is probably the biggest criteria now in deciding the fate of an embedded system. Nobody wants yesterdays model.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  4. #4
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,386
    Yes, electronics today is able to handle very complex software in a relative inexpensive way. Currently at work I'm on a project concerning a navigation system for cars. It's amazing how much functionality can be put in that little box.

    Time-to-market is very important these days, though I don't matter very much about that. The technical challenge means more to me than the marketing/financial-stuff, but I know it's important to keep those stuff in mind.

    A very remarkeble point in software projects is that the software is growing and growing. But at a point near the end the software seems to decrease in size. I don't know why, perhaps it has to do with optimizations which are going on in the later phases of a project.

    I'm working for three years on embedded systems now and I only used C and C++. Since the project I'm working on is just my second large project, I have not enough experience to note the differences. But as I understand from both of you: it doesn't really matter if you're using C or C++.

    Besides. What do you think is important for embedded systems programmers to learn these days in your opinion? I've been told that Java is getting very important since many machines are being equipped with internet technology.

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21