Re: name enum vs static named enum

2020-11-07 Thread Imperatorn via Digitalmars-d-learn
On Saturday, 7 November 2020 at 22:12:12 UTC, Arjan wrote: What is the usage of `static` in this? : ``` static enum Status { NONE, BUSY, ... } ``` It's redundant

name enum vs static named enum

2020-11-07 Thread Arjan via Digitalmars-d-learn
What is the usage of `static` in this? : ``` static enum Status { NONE, BUSY, ... } ```

Re: enum and static if

2015-03-12 Thread ketmar via Digitalmars-d-learn
On Wed, 11 Mar 2015 13:48:45 +, Namespace wrote: This code does not work: enum Test { Foo, static if (__VERSION__ = 2067) Bar, } Quatz } Any chance that this could work? nope. `static if` is statement, so it works only where statement is allowed

Re: enum and static if

2015-03-11 Thread Artur Skawina via Digitalmars-d-learn
On 03/11/15 15:41, ketmar via Digitalmars-d-learn wrote: On Wed, 11 Mar 2015 14:36:07 +, wobbles wrote: On Wednesday, 11 March 2015 at 14:34:32 UTC, ketmar wrote: On Wed, 11 Mar 2015 13:48:45 +, Namespace wrote: This code does not work: enum Test { Foo, static

Re: enum and static if

2015-03-11 Thread ketmar via Digitalmars-d-learn
, Namespace wrote: This code does not work: enum Test { Foo, static if (__VERSION__ = 2067) Bar, } Quatz } Any chance that this could work? nope. `static if` is statement, so it works only where statement is allowed. the same is true for `version`. this is by design

Re: enum and static if

2015-03-11 Thread Namespace via Digitalmars-d-learn
On Wednesday, 11 March 2015 at 14:34:32 UTC, ketmar wrote: On Wed, 11 Mar 2015 13:48:45 +, Namespace wrote: This code does not work: enum Test { Foo, static if (__VERSION__ = 2067) Bar, } Quatz } Any chance that this could work? nope. `static if` is statement

Re: enum and static if

2015-03-11 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, March 11, 2015 14:55:01 Namespace via Digitalmars-d-learn wrote: Thanks, I've hoped that 'static if' is a full replacement for #if Walter Bright has a rather dim view of #if and friends in C/C++ given how often he's seen them abused, which is why version and static if are more

Re: enum and static if

2015-03-11 Thread Nicolas Sicard via Digitalmars-d-learn
UTC, ketmar wrote: On Wed, 11 Mar 2015 13:48:45 +, Namespace wrote: This code does not work: enum Test { Foo, static if (__VERSION__ = 2067) Bar, } Quatz } Any chance that this could work? nope. `static if` is statement, so it works only where statement is allowed

Re: enum and static if

2015-03-11 Thread wobbles via Digitalmars-d-learn
On Wednesday, 11 March 2015 at 14:34:32 UTC, ketmar wrote: On Wed, 11 Mar 2015 13:48:45 +, Namespace wrote: This code does not work: enum Test { Foo, static if (__VERSION__ = 2067) Bar, } Quatz } Any chance that this could work? nope. `static if` is statement

Re: enum and static if

2015-03-11 Thread ketmar via Digitalmars-d-learn
On Wed, 11 Mar 2015 14:36:07 +, wobbles wrote: On Wednesday, 11 March 2015 at 14:34:32 UTC, ketmar wrote: On Wed, 11 Mar 2015 13:48:45 +, Namespace wrote: This code does not work: enum Test { Foo, static if (__VERSION__ = 2067) Bar, } Quatz } Any

enum and static if

2015-03-11 Thread Namespace via Digitalmars-d-learn
This code does not work: enum Test { Foo, static if (__VERSION__ = 2067) Bar, } Quatz } Any chance that this could work?

enum VS static immutable

2014-03-13 Thread ref2401
Hi. I have this structure: struct MyStruct { enum MyStruct VALUE = MyStruct(5f); static immutable MyStruct value = MyStruct(5f); float data; this(float v) { data = v; } } What's the difference between MyStruct.VALUE and MyStruct.value? How should I decide

Re: enum VS static immutable

2014-03-13 Thread w0rp
On Thursday, 13 March 2014 at 14:38:27 UTC, ref2401 wrote: Hi. I have this structure: struct MyStruct { enum MyStruct VALUE = MyStruct(5f); static immutable MyStruct value = MyStruct(5f); float data; this(float v) { data = v; } } What's the difference

Re: enum VS static immutable

2014-03-13 Thread ref2401
thank you

Re: enum VS static immutable

2014-03-13 Thread Ali Çehreli
On 03/13/2014 07:38 AM, ref2401 wrote: Hi. I have this structure: struct MyStruct { enum MyStruct VALUE = MyStruct(5f); static immutable MyStruct value = MyStruct(5f); float data; this(float v) { data = v; } } What's the difference between MyStruct.VALUE and