64Bit compatibility warnings

Peter Alexander peter.alexander.au at gmail.com
Thu Jan 19 16:46:34 PST 2012


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.

Remember that size_t is defined in druntime, not the language, so the 
compiler doesn't know what size_t is ahead of time.

version(D_LP64)
{
     alias ulong size_t;
     alias long  ptrdiff_t;
     alias long  sizediff_t;
}
else
{
     alias uint  size_t;
     alias int   ptrdiff_t;
     alias int   sizediff_t;
}


More information about the Digitalmars-d mailing list