version=D_16

Adrian Matoga via Digitalmars-d digitalmars-d at puremagic.com
Wed Jul 12 05:14:32 PDT 2017


On Monday, 10 July 2017 at 21:30:44 UTC, Walter Bright wrote:
> On 7/10/2017 1:52 PM, Luís Marques wrote:
>> On Monday, 10 July 2017 at 20:19:46 UTC, Walter Bright wrote:
>>> On 7/10/2017 12:46 PM, Luís Marques wrote:
>>> I'm curious how that implementation addresses the issues I 
>>> brought up:
>> 
>> I'm not really sure how to respond, you mostly just made 
>> statements about your worldview. For instance:
>> 
>> "C++ on a 64K machine is like using a tank to get to the 
>> grocery store". If you mean using all of C++ features, sure, 
>> that's inappropriate. If you mean that there are no C++ 
>> features that you could use in a microcontroller, there are 
>> non-trivial amounts of people the disagree with you.
>
> You can't use RTTI or Exceptions, for example. Those generate 
> bloat even if they are not used - a compiler switch is typical 
> to disable them. It's not true that C++ is "pay only for what 
> you use".
>
> If the C++ usage is "C with member functions", then yes, it'll 
> work and be useful.

There's more to that. Since these chips have limited 
computational capabilities, you really want to move as much 
computation as possible into compile time. And this is what makes 
C++ a better choice than C, and D a better choice than C++. It's 
also the safer and more expressive type system that saves you the 
time you would spent on debugging every kind of bug resulting 
from casting everything to void* and back.




More information about the Digitalmars-d mailing list