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

allocating an array of pointers to custom struct types #17

Open
jlongster opened this issue Oct 29, 2012 · 3 comments
Open

allocating an array of pointers to custom struct types #17

jlongster opened this issue Oct 29, 2012 · 3 comments

Comments

@jlongster
Copy link

If I try to compile this code:

struct Foo {
    int bar;
    int baz;
}

let Foo** arr = new Foo*[100];

I get this error:

main2.ljs:7:7: error: incompatible types: assigningdyn' to Foo**'

What am I doing wrong?

@rinon
Copy link
Collaborator

rinon commented Oct 29, 2012

I believe you need to do:

typedef Foo* FooPointer;
let FooPointer* arr = new FooPointer[100];

@jlongster
Copy link
Author

Yep, that worked. Is this a real bug? Since a lot of the syntax seems C/C++ inspired, seems like this could be a nice addition.

@mbebenita
Copy link
Owner

Yah, it seems to be broken. I'll take a look at it.

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