http://d.puremagic.com/issues/show_bug.cgi?id=5063

           Summary: Stronger typedef for size_t
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: accepts-invalid
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: bearophile_h...@eml.cc


--- Comment #0 from bearophile_h...@eml.cc 2010-10-16 10:08:54 PDT ---
It's better to design the D language to minimize the amount of changes (and
pitfalls) needed to port 32 bit code to 64 bit.

On 64 bit systems a size_t is 64 bit, while int/uint are 32 bit wide still. In
D code I've seen this, that compiles with no errors:

int i = array.length;

But on 64 bit systems this code throws away half of the bits of the length, and
I think the compiler doesn't allow that assignment without a cast.

So in that assignment size_t=>int I suggest to raise a compile error on 32 bit
systems too, so porting code from 32 to 64 bit doesn't require a change in that
line of code.

(Beside this one, there are few other situations where D2 may be changed to
avoid some troubles caused by porting 32 bit code to 64 bit code. I'd like such
other situations too to be addressed.)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to