bearophile can say "i told you so" (re uint->int implicit conv)

Kagamin spam at here.lot
Thu Apr 4 06:20:26 PDT 2013


On Tuesday, 2 April 2013 at 09:43:37 UTC, Jonathan M Davis wrote:
> Naturally, the biggest reason to have size_t be unsigned is so 
> that you can
> access the whole address space

Length exists to limit access to memory. If you want unlimited 
access, use just a pointer.

> For some people though, it _is_ a big deal on 32-bit machines. 
> For
> instance, IIRC, David Simcha need 64-bit support for some of 
> the stuff he was
> doing (biology stuff I think), because he couldn't address 
> enough memory on a
> 32-bit machine to do what he was doing. And I know that one of 
> the products
> where I work is going to have to move to 64-bit OS, because 
> they're failing at
> keeping its main process' memory footprint low enough to work 
> on a 32-bit box.
> Having a signed size_t would make it even worse. Granted, 
> they're using C++,
> not D, but the issue is the same.

I'm afraid, those applications are not tied to 32-bit ints. They 
just want a lot of memory because they have a lot of data. It 
means they want more than 4 gigs, so uint won't help in the 
slightest: it can't address more than 4 gigs, and applications 
will keep failing. There's a technology to use more than 4 gigs 
on 32-bit system:
http://en.wikipedia.org/wiki/Address_Windowing_Extensions
but uint still has no advantage over int, as it still can't 
address all the needed memory (which is more than 4 gigs).


More information about the Digitalmars-d mailing list