Re: C++ in embedded systems

From: Bill Pringlemeir (spam_account_at_sympatico.ca)
Date: 08/22/03

  • Next message: Matt Porter: "Re: struct pci-device and irq"
    Date: 21 Aug 2003 22:55:29 -0400
    
    

    On 19 Aug 2003, jpmv27@yahoo.com wrote:

    >> A programmer can buy this library without the fear that it uses
    >> exceptions or templates. A good thing (TM) imho.
    >
    > How does EC++ make this easier than a simple line of text in the
    > description of the library that would state "does not use exceptions
    > or templates"?

    ...And/or RTTI. You were completely write about all C++ style casts.
    Only dynamic cast is requiring RTTI support. I believe GCC will
    automatically warn about this if -fno-rtti is used. I guess this
    should be implicit.

    I think that having the Standard does help to quantify what library
    facilities are used. Does the average programmer have time to
    quantify every aspect of the language. Getting the compiler options
    correct with a binary only distribution can be problematic.

    I would be much more likely to buy/use a library that was Embedded
    'C++' compatible. Even after reading the working groups paper on C++
    performance, I think that exceptions are too expensive for my embedded
    devices with the compiler that is bundled with the OS. In fact I
    believe that stack tracing and tables will alway be more expensive in
    code space than letting a watch dog go. In the WG21 paper sighted,
    the exit/reset on error conditions didn't seem to be compared to EH
    overhead. Exit/reset on error are often used for simplicity and
    safety in embedded systems... at least that has been my experience,
    but maybe I am some sort of horrible barbarian.

    I do think that at some point linkers and compilers will become mature
    enough ( and host computers will be fast enough) that templates will
    be useable and beneficial in the embedded space. But I have never
    seen a compiler that handle templates well enough for my needs.

    Of course you can explicitly spell out every condition that a library
    adheres too, instead of just saying "Embedded C++ compliant". Just
    like you can do everything in assembly that you can do in C++.

    fwiw,
    Bill Pringlemeir.

    -- 
    If I gave a damn, you'd be the first person I'd give it to.
    

  • Next message: Matt Porter: "Re: struct pci-device and irq"

    Relevant Pages

    • Re: why still use C?
      ... > simply down the callstack which is more readable than gotos, ... The nice thing about exceptions is that the code throwing it shouldn't ... My latest try on doing something with templates was with a C++ compiler ...
      (comp.lang.c)
    • Re: advantages of C
      ... And constructors and destructors and templates and exceptions and ...
      (comp.programming)
    • Re: Benefits of Dynamic Typing
      ... exceptions because many of them are turned into exceptions by default. ... There are two families of dynamic typing: ... Emulation becomes hard when a statically typed language with closed ... I would say that C++ templates use a compile-time dynamic ...
      (comp.lang.functional)
    • Re: C vs C++ in Embedded Systems?
      ... This wasn't the main reason most people limited these features. ... Exceptions can be efficient in comparison to the alternative of ... Templates can be used just as smart type-checked macros. ... everything safely to have list-of-pointer-to-anything containers. ...
      (comp.arch.embedded)
    • Re: export (WAS: Boost Workshop at OOPSLA 2004) (WILL BE: Save Andrei)
      ... >> I can hardly imagine how anybody could argue that one. ... Templates aren't easy, exceptions ...
      (comp.lang.cpp)