Wednesday, May 14, 2008

Why not Embedded C++?

How embedded C++ differ from ISO C++?

Embedded C++(EC++) language is a subset of ISO C++ and a program written in EC++ can be compiled with any ISO C++ compiler. EC++ is formed by omitting following features of ISO C++.

1. Multiple Inheritance
2. Virtual base classes
3. Run Time Type Information
4. New style casts
5. The mutable type qualifier
6. Namespaces
7. Exceptions
8. Templates


Now let’s have a look on the facts of omitting these usages.


1. Multiple Inheritance

The reason to avoid multiple inheritance is quite simple. It is complex and not easy for even an expert programmer to design a class using multiple inheritance. But there are many superb interface hierarchies which we can form using multiple inheritance. The right way to avoid complexity is by setting rules instead of taking a feature out. By allowing and disallowing different hierarchies through a guideline is perfectly enough to avoid the confusions due to multiple inheritance.

2. Virtual base classes

If there is no multiple inheritance why would we need a virtual base class? Or else to avoid virtual base classes we have to omit multiple inheritance J.

3. Run Time Type Information

Run Time Type information can cause program size overhead because type information of the polymorphic classes is needed. It will only be advantageous for a program which is heavily polymorphic and it adds no merit to a program which is not much polymorphic. But every compiler including gcc has a compiler flag to either enable or disable RTTI. Any novice programmer can set it to off and now what is the need for such a omitting instead of a guide line not to use RTTI?

4. New style casts

Since EC++ omits RTTI the dynamic cast wont work. Even though EC++ don’t support new style casts static_cast will be valid. These alerting are either useless or artifact of disabling the RTTI.

5. The mutable type qualifier

It could rather be a guideline not to use mutable if the object is made as const than taking out such a feature. One of the best examples to understand the advantage of guidelines is to see there are hardly any goto statements in the programs even made by novices. The omitting of mutable also adds no advantage to a language for embedded system.

6. Namespaces

This is one of the weirdest omitting from the C++ language. The reason to omit namespaces is pretty simple because it is “EC++ committee thinks it is not essential to have namespaces”.

7. Exceptions

There are 2 major reasons to avoid exception handling in EC++.

1. It is difficult to estimate the time between when an exception has occurred and control has passed to a corresponding exception handler.
2. It is difficult to estimate memory consumption for exception handling.

Even in a real time environment what is the big deal in time between exception has occurred and caught? Even though there is unpredictability in throughput of exception handling it is always better not to crash your program or writing your own exception handling mechanisms. And still if exception handling need not be done in a program or at an environment it must be a guideline rather than freezing a feature of language.


8. Templates

The disadvantages of template are that it can introduce code bloat and the increase in program size. But templates make the development and code maintainability far better. Even template specialization or limiting to necessary types can be done for every class to avoid code bloat. To avoid careless usage of templates the proper method is never to take it out of the way.

Conclusion

It is always better to make guidelines rather than making a new language with subset of an existing one. To see the Stroustrup’s comments on embedded c++ can be found at Stroustrup's FAQ.

6 comments:

オテモヤン said...

オナニー
逆援助
SEX
フェラチオ
ソープ
逆援助
出張ホスト
手コキ
おっぱい
フェラチオ
中出し
セックス
デリヘル
包茎
逆援
性欲

boniourkee said...

很好啊..................................................

艾維 said...

只用微笑說話的人,才能擔當重任。..............................

book said...

只用微笑說話的人,才能擔當重任。 ..................................................

怡如 said...

a片性愛av女優性愛台灣性愛自影片性愛巴士線上看sex性愛洪爺線上免費直播免費男同志網免費性圖片免費東洋影片免費的av片免費的片免費的色情卡通免費直撥網免費直撥影片免費直播短片免費長片分享區免費咪咪影片網免費是訊免費洪爺色情免費洪爺色情網免費性愛觀看影片免費性愛影片分享區免費性愛動畫免費男做愛影片免費男影片免費男優免費亞洲影片免費性小說免費性片下載免費性交貼圖成人文學網a18禁女生遊戲區視訊聊天室ut聊天室

Anonymous said...

Types Of Leather Used In Making ShoesA company called Toms Shoes have gone one better by devising a policy to donate a pair of shoes to children in poor countries for every pair bought by the buying public. This company was founded in America in 2006 after its owner saw poor children running around without footwear. Sometimes these children did not go to school as schools do not admit pupils if they do not have any shoes to wear.[url=http://www.cheaptomsbuy.com]Cheap Toms sale[/url] Presently, admirable designs are accessible in toms shoes and those of you who are not abundant anxious about the amount tags can opt for customized added shoes. Some Toms shoes apply awful shock absorptive abstracts central the shoe so as to facilitate affluence of walking. Also, assertive models accept added toe boxes so that there is even added toe allowance for those who charge it. You can acquisition shoes with lycra and such stretchable abstracts as their top accoutrement which will acquiesce your anxiety to move about comfortably. There are abounding options accessible in the added class of shoes which are ablaze weight, adjustable and durable.If you buy shoes to the value of over 30 then shipping is free. The returns policy is also very simple. If the shoes are returned in pristine condition then a full refund is forthcoming. [url=http://www.onlinetomsoutlet.com]Toms Outlet[/url] Hearing the word TOMS shoes sketches in minds a picture of a shoes with colorful and bright patterns as well as a brand with a purpose. The brand is founded by an entrepreneur from Texas, Blake Mykoskie who was one of the contestants in the second season famous TV reality show Amazing Race. The whole idea of establishing a business on the foundation of social entrepreneurship was ignited in the mind of Blake when he observed children with bare feet somewhere in the undeveloped area of the country Argentina. Presently, admirable designs are accessible in Toms shoes and those of you who are not abundant anxious about the amount tags can opt for customized added shoes. Some Toms shoes apply awful shock absorptive abstracts central the shoe so as to facilitate affluence of walking. Also, assertive models accept added toe boxes so that there is even added toe allowance for those who charge it. You can acquisition shoes with lycra and such stretchable abstracts as their top accoutrement which will acquiesce your anxiety to move about comfortably. There are abounding options accessible in the added class of shoes which are ablaze weight, adjustable and durable. You can acquisition Toms shoes calmly in some specialty food and aswell in assertive accepted cossack stores. One of the easiest means to acquisition the appropriate brace of shoes is to seek online. [url=http://www.tomsfans.com]Cheap Toms Sale[/url] TOMS Shoes accepts the following forms of payment. Please be advised that they do however only accept one form of payment per order. Apart from protecting the feet from injury, the footwear also helps to prevent the population from the spread of intestinal worms. Infestation leads to malnutrition as the invasion of the worms will take all the goodness of the food we eat. The other important point is that well-fitting shoes prevent lesions to the foot which can become infected in a hot and humid climate with poor hygiene.
Relate Post
[url=http://shermanoaksmaid.com/2013/04/21/hostgator-coupon-codes-2013/#comment-3552]toms online high quality for you discount outlet[/url]
[url=http://rmed.ru/rmed.ru/board]cheap toms high quality for you discount outlet[/url]