Unions Not Supported

This forum is for all topics related to Simulator for Arduino v0.98. Please include sample code where possible.

Moderator: Adrian

paul.shubert
Posts: 2
Joined: Thu Dec 12, 2013 5:26 am

Unions Not Supported

Postby paul.shubert » Thu Dec 12, 2013 6:01 am

Unions do not appear to be supported. i.e. the following declaration:

Code: Select all

union Vector3 {
  int r[3];
  struct {
    int x;
    int y;
    int z;
  } s;
};

Vector3 vector;


Results in a 3x integer array named "r" when implemented in an Arduino ".ino" file, along with the error:
Sketch Error - unknown declaration union Vector3 {
Line: -1 union Vector3 {


When included in a library (#include) file.

Which would also imply that "struct" is also not supported?

Simulator_admin
Site Admin
Posts: 237
Joined: Thu Feb 02, 2012 6:07 pm

Re: Unions Not Supported

Postby Simulator_admin » Fri Sep 26, 2014 11:02 am

Thanks for pointing this out. Unions and structures are supported but the memory overlap which unions use will be implemented later.

The code above will work and run in version 0.99D due out shortly. Thanks


Return to “Version 0.98”

Who is online

Users browsing this forum: No registered users and 2 guests