On Tuesday, 31 October 2017 at 15:20:31 UTC, Igor Shirkalin wrote:
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
thanks. I just find it werid, maybe because I came from C/C++
background, where it means only integer types. So enum s = "foo";
is really werid. But I'll get used to it.