Phobos examples and auto

Steven Schveighoffer schveiguy at yahoo.com
Mon Nov 7 08:55:05 PST 2011


On Mon, 07 Nov 2011 11:51:36 -0500, Steve Teale  
<steve.teale at britseyeview.com> wrote:

> On Mon, 07 Nov 2011 07:17:59 -0500, Steven Schveighoffer wrote:
>> uint i = 5;
>> uint j = i;
>> uint k = j;
>> uint l = k;
>>
>> If I want to make this code 64-bit aware, I need to change all 4 lines.
>> If these lines are scattered throughout the code, I have to play the
>> cyclical compiler game, where I change the first one, then compile,
>> change the second one, compile, etc.
>
> Steve,
>
> OK, you've uncovered a stark example of my ignorance there. The Types
> documentation does not as far as I can see mention any differences
> between a 32 bit and a 64 bit environment. It says simply that a uint is
> 32 bits unsigned.
>
> What is the change that has to be made in your example?

Sorry, that is my fault.  My example was too devoid of context :)

Try this instead:

int[] arr;

uint i = arr.length;
...

i.e. the change that should be made is uint => size_t.

-Steve


More information about the Digitalmars-d mailing list