[email protected] wrote:
As I understand discussion so far: The atmega128 simulated cpu has pointers to its components. The atmega48 simulated cpu contains its components as objects.
Nice summary... and *much* less verbose than mine ;)
What reasons for avoiding pointers apply to the atmega48 that do not apply to the atmega128? If pointers are useful, two of the reasons for avoiding them could be avoided with smart pointers.
I assume that you mean to ask if pointers are useful within the context of the atmega128. I further assume that you mean to ask if they offer some advantage over implementing this containment as simple objects.
A smart pointer could be made so that it had to be initialized and so that its destructor deleted its target.
Yes, but "smart" pointers are an additional level of complexity that is only warranted if there is a need to use pointers in the first place.
That said, adding a level of indirection will slow things down a bit. BTW the simulator is not an embedded program.
It's hard to argue with that :) However, in my experience, techniques that are usable in embedded systems are often useful in "normal" applications, whereas the reverse is frequently not true. :) -- Michael N. Moran (h) 770 516 7918 5009 Old Field Ct. (c) 678 521 5460 Kennesaw, GA, USA 30144 http://mnmoran.org "So often times it happens, that we live our lives in chains and we never even know we have the key." "Already Gone" by Jack Tempchin (recorded by The Eagles) The Beatles were wrong: 1 & 1 & 1 is 1 _______________________________________________ Simulavr-devel mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/simulavr-devel
