This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Ram usage with ec++

Hi,

as I understand from this link: www.caravan.net/.../guide.html in point D1 it is not possible to put an object in ROM if that object is from a class that has been derived from another class, even though everything is const.

Isn't this a huge limitation in the embedded world with it's limited RAM?

Jef

Parents
  • How often do you need to override a C++ class, and need objects of that class to be const?

    An example would be an abstract "lookup" class overriden by a class having specific data. The alternative then would be to avoid the class override and implement the actual functionality directly. Or call helper functions if you need many lookup classes.

    In most situations, the needs looks different in an embedded application than in a PC application. Your const objects are normally quite simple, so you may not get snagged so often by this.

    A ring-buffer implemented in C++ is an example of a non-const object. A CSerial class would normally also be used to create non-const objects. Same with CTimer objects. In my experience, most classes that are overriden or having virtual methods, ... are having member data that makes it impossible to use a const object in the first place. But that may not be a general case, and more a result of how I tend to structure my programs.

Reply
  • How often do you need to override a C++ class, and need objects of that class to be const?

    An example would be an abstract "lookup" class overriden by a class having specific data. The alternative then would be to avoid the class override and implement the actual functionality directly. Or call helper functions if you need many lookup classes.

    In most situations, the needs looks different in an embedded application than in a PC application. Your const objects are normally quite simple, so you may not get snagged so often by this.

    A ring-buffer implemented in C++ is an example of a non-const object. A CSerial class would normally also be used to create non-const objects. Same with CTimer objects. In my experience, most classes that are overriden or having virtual methods, ... are having member data that makes it impossible to use a const object in the first place. But that may not be a general case, and more a result of how I tend to structure my programs.

Children
No data