www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Natural Word Length

reply "Mike" <none none.com> writes:
Is there a type in D that represents is always the unsigned 
natural word of the platform?
Dec 24 2013
next sibling parent "Jakob Ovrum" <jakobovrum gmail.com> writes:
On Tuesday, 24 December 2013 at 08:57:43 UTC, Mike wrote:
 Is there a type in D that represents is always the unsigned 
 natural word of the platform?
Yes, use the type `size_t`. It is an alias defined in object.d, which is a module part of druntime that is implicitly/automatically imported in all D modules, so `size_t` is available in all D code that uses druntime. Usually questions like this are better aimed at the D.learn group :)
Dec 24 2013
prev sibling parent reply Marco Leise <Marco.Leise gmx.de> writes:
Am Tue, 24 Dec 2013 08:57:41 +0000
schrieb "Mike" <none none.com>:

 Is there a type in D that represents is always the unsigned=20
 natural word of the platform?
alias =E2=84=95 =3D size_t; =E2=84=95 myWord =3D 123; --=20 Marco
Dec 26 2013
parent reply "JR" <zorael gmail.com> writes:
On Friday, 27 December 2013 at 07:25:46 UTC, Marco Leise wrote:
 alias ℕ = size_t;

 ℕ myWord = 123;
One part of me thinks that's absolutely beautiful and another part cries out in terror. ;>
Dec 27 2013
parent Timon Gehr <timon.gehr gmx.ch> writes:
On 12/27/2013 12:05 PM, JR wrote:
 On Friday, 27 December 2013 at 07:25:46 UTC, Marco Leise wrote:
 alias ℕ = size_t;

 ℕ myWord = 123;
One part of me thinks that's absolutely beautiful and another part cries out in terror. ;>
size_t is not the type of natural numbers.
Dec 27 2013