Thread overview
[bug?] enum xxx : char[]
Apr 17, 2004
C. Sauls
Apr 17, 2004
J C Calvarese
Apr 17, 2004
Walter
Apr 17, 2004
Kris
Apr 18, 2004
Walter
Apr 18, 2004
Kris
April 17, 2004
Are enum's not allowed to derive from char[]?  The following generates the given errors:

------------------------------constants.d
 16: enum EXT : char[] {
 17:     version (Win32) {
 18:         SRC = "d",
 19:         OBJ = "obj",	
 20:         LIB = "lib"
 21:     }
 22:
 23:     version (linux) {
 24:         SRC = "d",
 25:         OBJ = "o",	
 26:         LIB = "a"
 27:     }
 28: }
------------------------------
constants.d(16): { enum members } expected
constants.d(16): Declaration expected, not '['

-C. Sauls
-Invironz
April 17, 2004
C. Sauls wrote:
> Are enum's not allowed to derive from char[]?  The following generates the given errors:
> 
> ------------------------------constants.d
>  16: enum EXT : char[] {
>  17:     version (Win32) {
>  18:         SRC = "d",
>  19:         OBJ = "obj",    20:         LIB = "lib"
>  21:     }
>  22:
>  23:     version (linux) {
>  24:         SRC = "d",
>  25:         OBJ = "o",    26:         LIB = "a"
>  27:     }
>  28: }
> ------------------------------
> constants.d(16): { enum members } expected
> constants.d(16): Declaration expected, not '['
> 
> -C. Sauls
> -Invironz

I think enums are only allowed to be uint or int, but I'm not sure because "enum Name : type" hasn't been documented yet (or the documentation has been lost).

-- 
Justin
http://jcc_7.tripod.com/d/
April 17, 2004
"J C Calvarese" <jcc7@cox.net> wrote in message news:c5sea7$2mgk$1@digitaldaemon.com...
> C. Sauls wrote:
> > Are enum's not allowed to derive from char[]?

No, only integral types. It's a bug in the documentation, and a bug in the compiler.


April 17, 2004
.. and you can't (currently) use version{} inside an enum; would be handy if
you could.

- Kris

"C. Sauls" <ibisbasenji@yahoo.com> wrote in message news:c5sbpb$2j3s$1@digitaldaemon.com...
> Are enum's not allowed to derive from char[]?  The following generates the given errors:
>
> ------------------------------constants.d
>   16: enum EXT : char[] {
>   17:     version (Win32) {
>   18:         SRC = "d",
>   19:         OBJ = "obj",
>   20:         LIB = "lib"
>   21:     }
>   22:
>   23:     version (linux) {
>   24:         SRC = "d",
>   25:         OBJ = "o",
>   26:         LIB = "a"
>   27:     }
>   28: }
> ------------------------------
> constants.d(16): { enum members } expected
> constants.d(16): Declaration expected, not '['
>
> -C. Sauls
> -Invironz


April 18, 2004
"Kris" <someidiot@earthlink.dot.dot.dot.net> wrote in message news:c5sg1p$2opt$1@digitaldaemon.com...
> .. and you can't (currently) use version{} inside an enum; would be handy
if
> you could.

Matthew argued for this as well, but I don't agree. Visually, it looks cluttered to put versions down at such a low level. Version differences should be at a higher level.


April 18, 2004
Oh, I just meant that it could be convenient at times; I wouldn't want to argue over such an idiosyncrasy when there's bigger fish to fry; such as additional AA properties to pre-allocate and clear ... <g>



"Walter" <walter@digitalmars.com> wrote in message news:c5t4uo$o10$1@digitaldaemon.com...
>
> "Kris" <someidiot@earthlink.dot.dot.dot.net> wrote in message news:c5sg1p$2opt$1@digitaldaemon.com...
> > .. and you can't (currently) use version{} inside an enum; would be
handy
> if
> > you could.
>
> Matthew argued for this as well, but I don't agree. Visually, it looks cluttered to put versions down at such a low level. Version differences should be at a higher level.
>
>