size_t.sizeof == 2 && __LINE__.sizeof == 4

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Mon Jul 10 11:03:27 PDT 2017


On 7/10/17 1:49 PM, Luís Marques wrote:
> On Monday, 10 July 2017 at 17:32:01 UTC, Iain Buclaw wrote:
>> The official stance is that we don't.  There is just far too much 
>> baggage that gets piled in by default that makes it very hostile, 
>> however those of us who are capable of doing so won't try to stop you, 
>> and you have the likes of minilibd and other minimal D libraries as 
>> friendly replacement, perhaps you could even use them on top of musl. ;-)
> 
> By "we don't" it seems you are referring to supporting D + druntime + 
> Phobos. But, to clarify, plain -betterC D seems to work well. One issue 
> is that size_t currently has the wrong size, and changing it involves at 
> least some druntime support (changing object.d, and changing all of the 
> size_t line = __LINE__ fallout).

I think it's reasonable to instrument druntime/phobos with line_t, and 
then libraries may or may not work with 16-bit (I wouldn't be surprised 
if most don't), but at least they will likely work for files less than 
65k lines (quite a few) :)

e.g. this should work fine if super takes a line_t:

class MyException : Exception
{
   this(string msg, size_t line = __LINE__, string file = __FILE__)
   {
     super(msg, line, file);
   }
}

I will review and approve such a request if you make it. You'd likely 
need buy-in from Andrei.

-Steve


More information about the Digitalmars-d mailing list