Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
vala
vala
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 702
    • Issues 702
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 38
    • Merge Requests 38
  • Operations
    • Operations
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Repository
    • Value Stream
  • External Wiki
    • External Wiki
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
  • GNOME
  • valavala
  • Issues
  • #161

Closed
Open
Opened Jan 31, 2011 by bugzilla-migration@bugzilla-migrationReporter

initializers forbidden when allowed in C

Submitted by Jeremy List

Link to original bug (#641009)

Description

In C, I can initialize an array of structs (fixed size in this case) using the following syntax:

typedef struct _Tile Tile;

struct _Tile { gint x; gint y; };

Tile moves[6] = {{1, 1}, {0, 1}, {-1, 0}, {-1, -1}, {0, -1}, {1, 0}};

In Vala, the code I thought would do the same gave this error: Non-constant field initializers not supported in this context I can write code in Vala that gives the same eventual result, but I'm not entirely happy with how it gets implemented. It doesn't help that another bug forces me to initialize the array using calls to a construction method, I'm getting very tempted to write this section of the program in C and make a .vapi file to join it to the rest of the program it's for.

Version: 0.35.x

To upload designs, you'll need to enable LFS and have admin enable hashed storage. More information
Assignee
Assign to
1.2
Milestone
1.2
Assign milestone
Time tracking
None
Due date
None
Reference: GNOME/vala#161