digitalmars.D - Size_t on x86 is uint,on x64 is ulong,it's a good thing?
- FrankLike (4/4) Apr 17 2014 Size_t on x86 is uint,on x64 is ulong,it's a good thing?
- John Colvin (5/9) Apr 17 2014 It's the same in C and it reflects what the hardware is doing
- FrankLIKE (5/15) Apr 17 2014 Thank you,I think 'use uint' is better than 'use ulong' .
- monarch_dodra (7/12) Apr 17 2014 You are only supposed to use `size_t` (and `ptrdiff_t`) for
- FrankLIKE (6/10) Apr 17 2014 In c#,add the new attribute 'longlength' on the new version,keep
- Nick Sabalausky (3/7) Apr 17 2014 If you want fixed-length, you use uint/ulong/etc. The whole point of
Size_t on x86 is uint,on x64 is ulong,it's a good thing? I don't think is ok. it creates many convert thing,such as length is ulong ,must cast to int or cast to uint. It will be waste of time ,I think.
Apr 17 2014
On Thursday, 17 April 2014 at 16:36:29 UTC, FrankLike wrote:Size_t on x86 is uint,on x64 is ulong,it's a good thing? I don't think is ok. it creates many convert thing,such as length is ulong ,must cast to int or cast to uint. It will be waste of time ,I think.It's the same in C and it reflects what the hardware is doing underneath with regard to memory addresses. That's the point of size_t. If it didn't change size then we'd all just use ulong or uint for all our array lengths etc.
Apr 17 2014
On Thursday, 17 April 2014 at 16:46:15 UTC, John Colvin wrote:On Thursday, 17 April 2014 at 16:36:29 UTC, FrankLike wrote:Thank you,I think 'use uint' is better than 'use ulong' . You know that 'point.x,point.y' is int ,on x64 ,no change, 'length' keeps the same to 'point.x,point.y' ,maybe a good thing. Frank.Size_t on x86 is uint,on x64 is ulong,it's a good thing? I don't think is ok. it creates many convert thing,such as length is ulong ,must cast to int or cast to uint. It will be waste of time ,I think.It's the same in C and it reflects what the hardware is doing underneath with regard to memory addresses. That's the point of size_t. If it didn't change size then we'd all just use ulong or uint for all our array lengths etc.
Apr 17 2014
On Friday, 18 April 2014 at 00:31:20 UTC, FrankLIKE wrote:Thank you,I think 'use uint' is better than 'use ulong' . You know that 'point.x,point.y' is int ,on x64 ,no change, 'length' keeps the same to 'point.x,point.y' ,maybe a good thing. Frank.You are only supposed to use `size_t` (and `ptrdiff_t`) for things that represent pointer indexing, pointer offsets, or their genral abstractions (indexing a slice, getting the length of a range...). If you want to store "just a number", then select an integral type with pre-defined size.
Apr 17 2014
It's the same in C and it reflects what the hardware is doing underneath with regard to memory addresses. That's the point of size_t. If it didn't change size then we'd all just use ulong or uint for all our array lengths etc.the ‘length' in the attributes,and the type 'int' or 'uint' that is ok for most of condition ,maybe a longlength is ok for a little condition. Thank you. Frank
Apr 17 2014
On 4/17/2014 12:36 PM, FrankLike wrote:Size_t on x86 is uint,on x64 is ulong,it's a good thing? I don't think is ok. it creates many convert thing,such as length is ulong ,must cast to int or cast to uint. It will be waste of time ,I think.If you want fixed-length, you use uint/ulong/etc. The whole point of size_t is for when you need the hardware's native data size.
Apr 17 2014