variations of int sizes (and signded/unsigned) between platorms

Daniel Keep daniel.keep.lists at gmail.com
Tue Apr 24 20:43:53 PDT 2007



Jason House wrote:
> Daniel Keep wrote:
>> find should probably be returning ptrdiff_t, since that looks like what
>> you're getting.  If you try casting startComment to size_t on line 105,
>> that should work.
>>
>> FYI:
>>           | 32-bit alias | 64-bit alias |
>> size_t    |     uint     |     ulong    |
>> ptrdiff_t |     int      |     long     |
>>
>> Hope that helps.
>>
>>     -- Daniel
>>
> 
> It would help if the various distributions were consistent.  Digging a
> little, it appears that gdc for AMD64 returns ptrdiff_t while the code
> that comes with dmd returns int.  Also,
> http://www.digitalmars.com/d/phobos/std_string.html also says int.

True.  But then again, DMD only works on 32-bit archs, and since
ptrdiff_t is an alias they're *technically* the same :3

I suppose that problems like this will disappear once DMD starts
generating 64-bit executables, since it'll *have* to be addressed.  I
think it was Linus Torvalds who once remarked that porting something to
lots of platforms tended to expose a lot of bugs just like the above :P

	-- Daniel

-- 
int getRandomNumber()
{
    return 4; // chosen by fair dice roll.
              // guaranteed to be random.
}

http://xkcd.com/

v2sw5+8Yhw5ln4+5pr6OFPma8u6+7Lw4Tm6+7l6+7D
i28a2Xs3MSr2e4/6+7t4TNSMb6HTOp5en5g6RAHCP  http://hackerkey.com/


More information about the Digitalmars-d-learn mailing list