digitalmars.D.learn - 64 bit size_t
- Steve Teale (8/10) Feb 16 2014 Why is it that with 32 bit compilation, int is 32 bits, but
- Steve Teale (2/13) Feb 16 2014 Sorry parent.children is just a straightforward array
- Steve Teale (7/11) Feb 16 2014 Sorry again - forget about it. I'd forgotten that D actually says
- evilrat (2/14) Feb 16 2014 or use auto :)
- Kapps (6/18) Feb 17 2014 Rather than change it to int/ulong, just change it to 'size_t len
- Steve Teale (2/7) Feb 18 2014 Yup, that's what I did when my head returned to its usual postion
- evilrat (5/16) Feb 16 2014 it is equal to machine word size. 4 bytes on x86, 8 on x64.
- Mike Parker (3/5) Feb 16 2014 size_t is an alias to ulong on 64-bit. Aliases tend to show up in error
- Mike Parker (3/5) Feb 16 2014 It's ulong on 64-bit and uint on 32. size_t and ptrdiff_t are defined as...
Why is it that with 32 bit compilation, int is 32 bits, but apparently this convention is not followed in 64 bit compilation. I have not installed the 64 bit compiler yet, but apparently int len = parent.children.length+1; provokes the following erroracomp.d(782): Error: cannot implicitly convert expression (parent.children.length + 1LU) of type ulong to intparent is just a straightforward array What is size_t for 64 bit? Steve
Feb 16 2014
On Monday, 17 February 2014 at 07:15:20 UTC, Steve Teale wrote:Why is it that with 32 bit compilation, int is 32 bits, but apparently this convention is not followed in 64 bit compilation. I have not installed the 64 bit compiler yet, but apparently int len = parent.children.length+1; provokes the following errorSorry parent.children is just a straightforward arrayacomp.d(782): Error: cannot implicitly convert expression (parent.children.length + 1LU) of type ulong to intparent is just a straightforward array What is size_t for 64 bit? Steve
Feb 16 2014
On Monday, 17 February 2014 at 07:17:06 UTC, Steve Teale wrote:Sorry again - forget about it. I'd forgotten that D actually says int is 32 bits, and ulong is 64, and size_t for a 64 bit machine is obviously 64. I'll just go through the code and either change int to ulong or use a cast. ;=(What is size_t for 64 bit? SteveSorry parent.children is just a straightforward array
Feb 16 2014
On Monday, 17 February 2014 at 07:46:02 UTC, Steve Teale wrote:On Monday, 17 February 2014 at 07:17:06 UTC, Steve Teale wrote:or use auto :)Sorry again - forget about it. I'd forgotten that D actually says int is 32 bits, and ulong is 64, and size_t for a 64 bit machine is obviously 64. I'll just go through the code and either change int to ulong or use a cast. ;=(What is size_t for 64 bit? SteveSorry parent.children is just a straightforward array
Feb 16 2014
On Monday, 17 February 2014 at 07:46:02 UTC, Steve Teale wrote:On Monday, 17 February 2014 at 07:17:06 UTC, Steve Teale wrote:Rather than change it to int/ulong, just change it to 'size_t len = parent.children.length+1' (or auto instead of size_t). This way it's proper for both 32-bit and 64-bit and you don't need to worry about architecture. If you do need a signed version, you can use ptrdiff_t.Sorry again - forget about it. I'd forgotten that D actually says int is 32 bits, and ulong is 64, and size_t for a 64 bit machine is obviously 64. I'll just go through the code and either change int to ulong or use a cast. ;=(What is size_t for 64 bit? SteveSorry parent.children is just a straightforward array
Feb 17 2014
Rather than change it to int/ulong, just change it to 'size_t len = parent.children.length+1' (or auto instead of size_t). This way it's proper for both 32-bit and 64-bit and you don't need to worry about architecture. If you do need a signed version, you can use ptrdiff_t.Yup, that's what I did when my head returned to its usual postion ;=)
Feb 18 2014
On Monday, 17 February 2014 at 07:15:20 UTC, Steve Teale wrote:Why is it that with 32 bit compilation, int is 32 bits, but apparently this convention is not followed in 64 bit compilation. I have not installed the 64 bit compiler yet, but apparently int len = parent.children.length+1; provokes the following errorit is equal to machine word size. 4 bytes on x86, 8 on x64. but it looks like length is not size_t but ulong in which case you need explicit cast from larget to smaller type. check lenght signatureacomp.d(782): Error: cannot implicitly convert expression (parent.children.length + 1LU) of type ulong to intparent is just a straightforward array What is size_t for 64 bit? Steve
Feb 16 2014
On 2/17/2014 4:23 PM, evilrat wrote:but it looks like length is not size_t but ulong in which case you need explicit cast from larget to smaller type. check lenght signaturesize_t is an alias to ulong on 64-bit. Aliases tend to show up in error messages as the underlying type.
Feb 16 2014
On 2/17/2014 4:15 PM, Steve Teale wrote:parent is just a straightforward array What is size_t for 64 bit?It's ulong on 64-bit and uint on 32. size_t and ptrdiff_t are defined as aliases in object.d.
Feb 16 2014