"version" private word

Igor Shirkalin mathsoft at inbox.ru
Tue Oct 31 15:20:31 UTC 2017


On Tuesday, 31 October 2017 at 14:54:27 UTC, Dr. Assembly wrote:
> On Tuesday, 31 October 2017 at 13:53:54 UTC, Jacob Carlborg 
> wrote:
>> On 2017-10-31 14:46, Igor Shirkalin wrote:
>>> [...]
>>
>> The only alternative is to do something like this:
>>
>> version (X86)
>>     enum x86 = true;
>> else
>>     enum x86 = false;
>>
>> else version (X86_64)
>>     enum x86_64 = true;
>> else
>>     enum x86_64 = false;
>>
>> static if (x86 || x86_64) {}
>
> Why is that keyword called enum? is this any related to the 
> fact enumeration's field are const values? it would be called 
> invariable or something?

You're right. Enum defines constant or group of constants in 
compile time.
The full description of enum can be found here: 
https://dlang.org/spec/enum.html


More information about the Digitalmars-d-learn mailing list