Re: [Vala] enums




On Thu, 2007-11-08 at 14:40 +0100, pancake wrote:
It is not possible to define an enum inside a class definition?

public class Foo.Bar
{
        enum Constants {
                OK       = 0,
                ERROR    = 1,
                INTERNAL = 2
        }
       ...

That's just not implemented yet, we'll add support for this.

So, i think that definitions like:

public class Foo.Bar
{
   enum {
    OK = 0,
    ERR = 1,
    INT = 2
   }
}

should be converted into defines like:
  #define FOO_BAR_OK 0
  #define FOO_BAR_ERR 1
...

this probably breaks the syntax transformation..so..maybe we should
be able to define anonymous enums and named enums like C does, but for vala:

I don't see a reason for supporting anonymous enums, you can just use
constants in namespaces or classes for that purpose.

Btw...it is possible to define the type for an enum? or are they always integers?

No, they are always integers.

Jürg




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]