C++ for embedded
Angelo Fraietta
angelo_f at bigpond.com
Mon Mar 25 01:48:53 UTC 2002
This demo shows how you can use operator new and shows how it is
returned as the address of the array.
Peter Mueller wrote:
>Hi Angelo,
>
>can you send me an example?
>
>Thanks,
>Peter
>
>On Sat, 23 Mar 2002 12:25:41 +1100
>Angelo Fraietta <angelo_f at bigpond.com> wrote:
>
>>You can allocate the memory for a class however and wherever you want to
>>by overloading operators new and delete (you don't even have to allocate
>>memory, you just return a ponter to it). If you have members of a class
>>that need to be allocated as ROM, that is not a problem so long as you
>>make these const. You could still have non default constructors in these
>>ROM allocated classes so long as you do not try to change any members of
>>the class (as they must be const also and so you cannot pre-set them
>>even in a default constructor as your memory is read only). So what
>>your class effectively becomes is a class interface to the ROM. As long
>>as all the classes members are const, there is no problem that I am
>>aware of.
>>
>>Peter Mueller wrote:
>>
>>>Hi all,
>>>
>>>we want to use C++ for our future systems. But it seems that there are several design aspects that should be taken into account to develop efficient C++ code especially in terms of RAM usage. E.g. to be able to put an object into rom the class can not have
>>>- others than the default ctor
>>>- only public methods etc
>>>- ...
>>>
>>>I found some links in the net but not much. Can you recommend papers etc. about this topic and C++ in embedded systems in general?
>>>
>>>Thanks a lot,
>>>Peter
>>>
>>--
>>Angelo Fraietta
>>
>>PO Box 859
>>Hamilton NSW 2303
>>
>>Home Page
>>
>>
>>http://www.users.bigpond.com/angelo_f/
>>
>>There are those who seek knowledge for the sake of knowledge - that is CURIOSITY
>>There are those who seek knowledge to be known by others - that is VANITY
>>There are those who seek knowledge in order to serve - that is LOVE
>> Bernard of Clairvaux (1090 - 1153)
>>
>>
>>
>>
>
>
--
Angelo Fraietta
PO Box 859
Hamilton NSW 2303
Home Page
http://www.users.bigpond.com/angelo_f/
There are those who seek knowledge for the sake of knowledge - that is CURIOSITY
There are those who seek knowledge to be known by others - that is VANITY
There are those who seek knowledge in order to serve - that is LOVE
Bernard of Clairvaux (1090 - 1153)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20020325/6c6e8744/attachment-0001.html>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: OperatorNew.CPP
URL: <http://lists.rtems.org/pipermail/users/attachments/20020325/6c6e8744/attachment-0001.ksh>
More information about the users
mailing list