??? 07/19/09 21:15 Read: times |
#167567 - C++ and 8051 are not a really good match Responding to: ???'s previous message |
Andy Neil said:
I get a similar impression with many of the anti-C++ tirades from 'C' programmers... I absolutely love C++. But it is my personal belief that you will gain very little from using it on a 8051, because of the pointer problems with the processor core. A very big improvement would have been to use objects, but the 8051 do not like the "this" pointer. Many other processors would actually gain from the use of objects. They can - without cost - add a small offset to the "this" pointer for all read and write accesses instead of having to bother with full addressing if the data had been stored as separate variables. The improved type checking helps catching problems early. But if you do use references, objects or templates you will get nice source code but a 8051 binary that will not run well. If doing projects on an ARM, I would recommend that you take a closer look at C++. Start by using it as a C compiler and fight for some time with all the extra warnings/errors you get when you compile and the compiler catches problems. If your programs can take advantages of using structs, take a closer look at them. Would it be meaningful to bind functions directly to these structs? Then you should consider modifying them from global functions into object methods. |