Please go to the Red Marked
Short Answer if you except Short answer and don't need to read my crap.
yes true , if your a beginner to the C/C++ world then you could throw away the differences and safely
learn your own way.
For your information:
But fact wise there is a difference, C won't become C++ and these two specification were
maintained by two separate working groups. C is known as high level assembly language.Some developers feel
it's easy to deal with "C" than C++. Because C++ adds some messy things that can't be fixed into the system level.
For a example your writing a call gate transfer routine [SwitchRoot()] like procedure , then you disable all interrupts
,then your code throws an exception, but your ABI implements exceptions via interrupts, so that interrupt will
simply be ignored. Because some syntatic magic in C++ won't come as magic in system level, there is a issue.
I have seen embedded programming IDE's and SDK's which use C++ developer environment. And there , it's ABI
is completely defined. So in that case it's not messy.
There is a debt going on here:
http://stackoverflow.com/questions/2226 ... ons-or-not
^- it's school of taughts and I don't need that. I want to go more factwise,you better read that,but don't bring that
debt here.
FYI: Today most of the embedded platforms support full C++ features, Here is the ARM7 EABI[extended Appliation
Binary Interface] document. (ARM7 is the fav proc of Saman).
http://infocenter.arm.com/help/topic/co ... cppabi.pdf
according to their ABI , they implement exceptions using classes hierarchy. (like in java).
But some other compiler GNU ARM toolchain may implement it another way. Personally you won't met a case
that you need to use two C++ compilers from two toolchain's.But there are incidents you may have to use
one toolchain's C++ compiler and some other's assembler. In a case like that there may be serious binary
incompatibilities. Then you will have to fix the incompatible code in advance.
And I have to add this too. Almost every compiler have some extensions to the pure ANSI C++ language.
Even GNU C++ and Visual Studio C++ also adds these extensions.A good example is '__dllimport'.
__attribute__(()), and you could turn off and on this behavior as you need.
In some embedded compilers I have seen 'interrupt' is a reserved keyword or an annotation like 'main'
method. So there are many instances that you can't simply deal with your C/C++ knowledge. There are
many instances that you need to go and dig into the ABI and user manuals.
They have tried harder to make your C++ environment as pure as they could. But there are certenly places
that you needed to dig in. I could take the __config macro as an example.
Code: Select all
/* Register CONFIG2 (0x157fc) */
#define _CONFIG2(x) __attribute__((section("__CONFIG2.sec,code"))) int _CONFIG2 = (x);
^- so in SDCC it have defined config with an __attribute__, so there is nowhere you could escape from the
reality.
If you feel somewhat messy my above facts better just ignore it , and ramp up your C++ skills first and come
back here.Go on your own way, but remember C and C++ are two different. Even their front ends are not same.
When you working very closely to the linker editors etc etc, C over C++ make your eyes more obvious.But my
personal idea is it won't hurt your embedded development, it come into a pain when you writing and maintaining
operating systems where binary standard is a issue.
Short Answer
>> As I know,C++ language is a common language for every C base languages.Am I correct?
As I already given the answer,yes it is. ANSI C++ is a well defined specification /standard which is unique among all
the computing universe. But the problem is we couldn't live only with that. Because of that your compiler implements
some additional extensions to support your environment. But those dirty parts are encapsulated and your compiler
vendor is trying hard to present their compiler as pure C++. And yes Learn C++ as in general and it will help your
embedded programming.
>> Now I am learning C++ language.But,some say C++ not want for System Embedded Programming.
In embedded programming no, you could use complete C++ with it's complete features. exceptions , templates,
classes an all features. But there will be few instances where you need to turn up and read the ABI. Don't worry
C++ extensions are completely supported by embedded programming.
>> So,I want to know about C++ and MikroC.what are different between this tow languages?[Actually,are those tow languages?]
ANSI C++ is a computing standard, and MicroC is a compiler,it's a vendor name.
But there are extensions to support some crap.If you find this messy just ignore this for a moment.
>> I kike to be a person who has good knowledge about System Embedded technology.therefore,Now I am learning C++ language
C/C++ is like just 'ABC' in computing. It's like a language spoken. Without that language, you can't read a book
which is written in that language. So yes learn it , it helps.
--thanks for reading this--( I would like if you read my long answer even with some difficulty)
sandun.