Mutex in a struct?

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
nxtboyiii
Posts: 366
Joined: 02 Oct 2010, 07:08
Location: Everywhere

Re: Mutex in a struct?

Post by nxtboyiii »

mcsummation wrote:I made the macro handle the mutex issue.

However, I have another thing now:

Code: Select all

struct a {
    string b;
    string c[];
};
a aa;
string d[];
string e;
long l;
task main() {
e = FlattenVar(l); // This works.
d[0] = FlattenVar(l); // So does this.
aa.b  = FlattenVar(l);  // And, yet again, it works.
aa.c[0] = e; // This doesn't work.
aa.c[0] = FlattenVar(l);  // Neither does this.
}
Why don't the last two work? The next to the last says "Data types are not compatible". The last one gives that plus a couple of other errors which would be secondary issues.
Wow, that makes no sense why it does not work. Weird...
Thanks, and have a nice day,
nxtboy III

programnxt.com
afanofosc
Site Admin
Posts: 1256
Joined: 26 Sep 2010, 19:36
Location: Nashville, TN
Contact:

Re: Mutex in a struct?

Post by afanofosc »

The last two don't work because my compiler's homegrown parsing code isn't written to handle that particular syntax. But even if it did handle that syntax you would likely run into strange crashes that could be a compiler defect or a firmware defect related to complex structs - where "complex" means "containing 2d arrays" (and maybe other things too). Remember that an array of string is a 2d array of byte. My advice?

KISS.

John Hansen
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests