enums - Typed constant declaration list -


i wish create "enum-like" list of constants following properties:

  1. the values of each identifier sequential, few gaps. (i believe iota , blank identifier in regard).
  2. the identifiers private module.
  3. the constants can compared other constants of same type.

the enumeration based on enum fuse_opcode fuse. here's code i'm trying accomplish (and wrong):

const opcode (     _ = iota // skip 0     lookupop     forgetop     getattrop     setattrop     readlinkop     symlinkop // 6     _ // skip 7     mknodop // 8     // et cetera ad nauseam ) 

here's go code fuse opcodes. created enum fuse_opcode. typically write script that; used text editor. since constant values match c enum values, explicit values used.

package fuse  type opcode int32  const (     oplookup      = 1     opforget      = 2     opgetattr     = 3     opsetattr     = 4     opreadlink    = 5     opsymlink     = 6     opmknod       = 8     opmkdir       = 9     opunlink      = 10     oprmdir       = 11     oprename      = 12     oplink        = 13     opopen        = 14     opread        = 15     opwrite       = 16     opstatfs      = 17     oprelease     = 18     opfsync       = 20     opsetxattr    = 21     opgetxattr    = 22     oplistxattr   = 23     opremovexattr = 24     opflush       = 25     opinit        = 26     opopendir     = 27     opreaddir     = 28     opreleasedir  = 29     opfsyncdir    = 30     opgetlk       = 31     opsetlk       = 32     opsetlkw      = 33     opaccess      = 34     opcreate      = 35     opinterrupt   = 36     opbmap        = 37     opdestroy     = 38     opioctl       = 39     oppoll        = 40     opnotifyreply = 41 ) 

Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -