RFC: Pay-as-you-go, Portable D Runtime for Microcontrollers (and maybe more)

Mike via Digitalmars-d digitalmars-d at puremagic.com
Tue May 5 19:44:53 PDT 2015


On Tuesday, 5 May 2015 at 17:27:05 UTC, Johannes Pfau wrote:
> Am Tue, 05 May 2015 08:41:13 -0700
> schrieb Dan Olson <zans.is.for.cans at yahoo.com>:
>
>> Iain Buclaw via Digitalmars-d <digitalmars-d at puremagic.com> 
>> writes:
>> 
>> > If the cost is too much (ie: there is no heap), then we 
>> > should be
>> > able to stop emutls from kicking in by preventing the D 
>> > frontend
>> > from returning true on isThreadLocal calls.
>> 
>> Iain, I think something like this would be good in GDC.  Makes 
>> it so
>> much easier to compile for no thread environments.
>
> I'm not really sure about this. It's trivial to implement but it
> generates a semantic difference which harms code portability 
> (e.g. if
> you have code where you want a global variable, don't mark it as
> __gshared and then move to an environment with threads).

I'm coming around and feeling inclined to agree with this.  One 
of the things I want to avoid is creatIng an embedded dialect of 
the D.  I hope D for microcontrollers, kernels and such looks 
very much like the idiomatic D in the application programming 
domain.

What I would like to see, however, is a friendly compiler error 
like "This platform does not support thread-local storage.  
Please decorate your global variables with __gshared." rather 
than "undefined reference '_d_get_address'" from the linker.


Mike


More information about the Digitalmars-d mailing list