Came here to see if there was some sort of funky syntax usedfor two dimensional arrays of structs in RobotC and found confirmation that what I was seeing (all struct members zeroed out).

Any update on when 4.0 is coming out for the NXT? I'm alsowaiting on the ability to #include header files containing pragmas.

Thanks.

Tue Jan 21, 2014 1:10 am

skatefriday

Novice

Joined: Tue Dec 11, 2012 9:19 pmPosts: 58

Re: Array initialization

skatefriday wrote:

For what it's worth I just discovered this independently.

Came here to see if there was some sort of funky syntax usedfor two dimensional arrays of structs in RobotC and found confirmation that what I was seeing (all struct members zeroed out).

Any update on when 4.0 is coming out for the NXT? I'm alsowaiting on the ability to #include header files containing pragmas.

Thanks.

This...

Code:

typedef struct example_bug_ { int foo; int bar;} example_bug_t;

example_bug_t foobar[] = { { 1, 2 }, { 2, 3 }};

produces

Code:

*Error**:Wrong number of initialization elements for second array bound of 'foobar'

4.26 update, this appears to still be a bug in 4.x.

Any idea if it might be fixed in the near future?

Sat Sep 27, 2014 11:04 pm

skatefriday

Novice

Joined: Tue Dec 11, 2012 9:19 pmPosts: 58

Re: Array initialization

skatefriday wrote:

This...

Code:

typedef struct example_bug_ { int foo; int bar;} example_bug_t;

example_bug_t foobar[] = { { 1, 2 }, { 2, 3 }};

produces

Code:

*Error**:Wrong number of initialization elements for second array bound of 'foobar'

4.26 update, this appears to still be a bug in 4.x.

Any idea if it might be fixed in the near future?

Or rather the original bug appears to have morphed into onein which the above doesn't compile. I did leave out the arraysize, but the compiler should be able to determine that from thestatic initializer, just like it can determine a char array size froma literal string initializer.

This is a really useful construct. Any clue whether it's on thefeature list?

Who is online

Users browsing this forum: No registered users and 1 guest

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum