Thread overview
[dmd-beta] 32 to 64 bit portability guide
Jan 15, 2011
Walter Bright
Jan 16, 2011
Jason House
Jan 16, 2011
Brad Roberts
Jan 16, 2011
Jacob Carlborg
Jan 16, 2011
Walter Bright
Jan 19, 2011
Sean Kelly
Jan 19, 2011
Walter Bright
January 15, 2011
A start:

http://www.digitalmars.com/d/2.0/32-64-portability.html
January 15, 2011
The printf thing is the only portability issue that's a bit of a surprise to me. Is there anything that can be done in D2 to prevent the 32-bit-only method from compiling?

Sent from my iPhone

On Jan 15, 2011, at 4:47 PM, Walter Bright <walter at digitalmars.com> wrote:

> A start:
> 
> http://www.digitalmars.com/d/2.0/32-64-portability.html
> _______________________________________________
> dmd-beta mailing list
> dmd-beta at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/dmd-beta
January 15, 2011
On 1/15/2011 1:47 PM, Walter Bright wrote:
> A start:
> 
> http://www.digitalmars.com/d/2.0/32-64-portability.html

I'd s/should/must/ in that printf sentence.  NOT specifying it as two separate values leads to segv or corrupted output.  There are no circumstances, outside the purely accidental alignment of the stars, that the old way works.
January 16, 2011
We already have a portability guide: http://www.digitalmars.com/d/2.0/portability.html . It exists for D1 as well.

On 15 jan 2011, at 22:47, Walter Bright wrote:

> A start:
> 
> http://www.digitalmars.com/d/2.0/32-64-portability.html
> _______________________________________________
> dmd-beta mailing list
> dmd-beta at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/dmd-beta

-- 
/Jacob Carlborg

January 16, 2011
I'd forgotten about that. We need to merge them!

Jacob Carlborg wrote:
> We already have a portability guide: http://www.digitalmars.com/d/2.0/portability.html . It exists for D1 as well.
>
> On 15 jan 2011, at 22:47, Walter Bright wrote:
>
> 
>> A start:
>>
>> http://www.digitalmars.com/d/2.0/32-64-portability.html
>>
>> 
January 19, 2011
On Jan 15, 2011, at 1:47 PM, Walter Bright wrote:

> A start:
> 
> http://www.digitalmars.com/d/2.0/32-64-portability.html

printf("s = '%.*s'\n", s.length, s.ptr); // 32 and 64 bit

Is the above correct?  The above syntax expects an int for the length and s.length will be a ulong.  Or does the compiler do some sort of implicit cast?
January 19, 2011

Sean Kelly wrote:
> On Jan 15, 2011, at 1:47 PM, Walter Bright wrote:
>
> 
>> A start:
>>
>> http://www.digitalmars.com/d/2.0/32-64-portability.html
>> 
>
> printf("s = '%.*s'\n", s.length, s.ptr); // 32 and 64 bit
>
> Is the above correct?  The above syntax expects an int for the length and s.length will be a ulong.  Or does the compiler do some sort of implicit cast?
>
> 

Yes, it works fine. Both ints and ulongs are passed the same way, in an 8 byte value. The printf will just read the lower 4 bytes. If you're sending a string larger than 4 gigs to printf, you've got other problems :-)