Re: [Vala] [Genie] valac 0.8.x bug with const arrays?



I worked out a hackish workaround and found another bug (below)

init

  configFile : string = "/etc/gnation/config.xml"
  versionFlag : bool = false
  licenseFlag : bool = false

  // This is a horrible workaround for valac not understanding array of
struct
  configEntry : OptionEntry = { "config", 'c', OptionFlags.IN_MAIN,
    OptionArg.FILENAME, ref configFile,
    "Use alternative configuration", "FILE" }

  licenseEntry : OptionEntry = { "license", 'L', OptionFlags.IN_MAIN,
    OptionArg.NONE, ref licenseFlag,
    "Print software license and exit", null }

  versionEntry : OptionEntry = { "version", 'V', OptionFlags.IN_MAIN,
    OptionArg.NONE, ref versionFlag,
    "Print version information and exit", null }

  nullEntry : OptionEntry = { null }

  entries : array of OptionEntry = {
    configEntry,
    licenseEntry,
    versionEntry,
    nullEntry }


As the comment implies, shortening all this into a OptionEntry gives the
error:
init.gs:32.37-32.37: error: Expected array element, got array initializer
list

If anyone else runs into this problem (I assume its common given that this
is from an example on the Genie website) I hope this helps you work around
it, at least until someone gets around to fixing these bugs.


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