Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
December 24, 2013 Natural Word Length | ||||
---|---|---|---|---|
| ||||
Is there a type in D that represents is always the unsigned natural word of the platform? |
December 24, 2013 Re: Natural Word Length | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mike | 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 :)
|
December 27, 2013 Re: Natural Word Length | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mike | 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 natural word of the platform? alias ℕ = size_t; ℕ myWord = 123; -- Marco |
December 27, 2013 Re: Natural Word Length | ||||
---|---|---|---|---|
| ||||
Posted in reply to Marco Leise | 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. ;>
|
December 27, 2013 Re: Natural Word Length | ||||
---|---|---|---|---|
| ||||
Posted in reply to JR | 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.
|
Copyright © 1999-2021 by the D Language Foundation