64Bit compatibility warnings

Timon Gehr timon.gehr at gmx.ch
Fri Jan 20 17:16:20 PST 2012


On 01/21/2012 01:48 AM, Stewart Gordon wrote:
> On 20/01/2012 00:46, Peter Alexander wrote:
>> On 20/01/12 12:25 AM, Trass3r wrote:
>>> Could we please have at least a warning if code isn't compatible with
>>> 64Bit?
>>> It's really annoying to test out some code and having to fix a bunch of
>>> stupid uint->size_t bugs just because the author is still on a 32 bit
>>> machine.
>>>
>>> Is that feasible?
>>
>> In general, no. What you're asking is for the compiler to compile your
>> code twice, once
>> for 32-bit and once for 64-bit.
>
> No it isn't. It's basically asking to make size_t/ptrdiff_t not
> implicitly convertible to uint/int, or at least issue a warning if you
> implicitly convert between them.
>
> At least some Microsoft C++ complier versions have this warning.
>
> Stewart.

I generally like the idea of making size_t strongly typed, but
that would necessitate X!size_t to become a distinct instantiation from 
X!uint or X!ulong. Furthermore, it would break all existing D programs 
that are deliberately not 64 bit aware =).


More information about the Digitalmars-d mailing list