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

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

Comments

Projects
None yet
3 participants

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?

Collaborator

rinon commented Oct 29, 2012

I believe you need to do:

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

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.

Owner

mbebenita commented Oct 29, 2012

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