Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create arrays as structs members #10

Closed
gmarty opened this issue Jul 23, 2012 · 3 comments
Closed

Create arrays as structs members #10

gmarty opened this issue Jul 23, 2012 · 3 comments
Assignees

Comments

@gmarty
Copy link

gmarty commented Jul 23, 2012

I'd like to know if you plan on adding the possibility to create arrays as struct members.

AFAIK, it is not possible. Such code won't compile:

struct Point {
  int x, y;
};
struct Octogon {
  Point points[8];
};

Though I can define arrays like this:

let points = new Point[8];

It doesn't seem to be possible to do in structs.

@mbebenita
Copy link
Owner

Yes, I think we definitely need something like that. For now you can do something like:

struct Octogon {
  Point * points;
}

and then

let Octogon o;
o.points = new Point[8];

@rinon
Copy link
Collaborator

rinon commented Jul 23, 2012

I'll try to take of this when I finish a couple other things I'm working on. I think I will need to hack the parser a bit more to allow this.

I would also like to support inline unions, such as:

struct S {
  union {
    int x;
    float y;
  };
}

@ghost ghost assigned rinon Jul 23, 2012
@rinon
Copy link
Collaborator

rinon commented Jul 25, 2012

This is implemented as of rev 72e1d84.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants