Apparently unsigned types really are necessary

Marco Leise Marco.Leise at gmx.de
Sun Jan 22 14:17:11 PST 2012


Am 22.01.2012, 21:44 Uhr, schrieb Kagamin <spam at here.lot>:

> On Sunday, 22 January 2012 at 09:31:15 UTC, Marco Leise wrote:
>> So everyone uses int, and we get messages like: "This program currently  
>> uses -1404024 bytes of RAM". I have strong feelings against using  
>> signed types for variables that are ever going to only hold positive  
>> numbers, especially when it comes to sizes and lengths.
>
> If you ignore type limits, you're asking for trouble. Imagine you have 2  
> gigs of ram and 3 gig pagefile on 32-bit OS. What is the total size of  
> available memory?

I can use up to 4GB of that in the address space of my application - the  
value range of a uint, qed


More information about the Digitalmars-d mailing list