64Bit compatibility warnings

Don Clugston dac at nospam.com
Tue Jan 24 02:37:39 PST 2012


On 20/01/12 01:25, 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?


IMHO the ideal solution would be:
- treat size_t as a magical type (not a simple alias).
- allow size_t -> uint if you are in a machine-specific version 
statement that implies 32 bits (eg, version(D_InlineAsm_X86), 
version(Win32), version(X86)).
- allow size_t -> ulong if you are in a version statement that implies 
64 bits.
- Otherwise, disallow implicit casts.

Incidentally this was a motivation for the 'one-definition rule' that I 
proposed for version statements: it means the compiler can easily 
identify which versions imply machine-specific.


More information about the Digitalmars-d mailing list