qcc - unmaned struct/union defines no instance

I seem to have the problem when a union with a defined name causes a
problem.

e.g. typedef struct {
union {
double a;
int b;
};
} Input;

Input input;

input.a = 1.0;

Now I should be able to define a variable Input and access the a or b
structure members. However I get the errors,
warning: unnamed strcut/union that defines no instance
and
structure has no member named ‘a’

I can get around this by giving the union a name but really this should
work, and I have to change a mountain of code
that I’m trying to port. Is there a fix for this ? I believe I’m using QNX
Neutrino version 6.2.

Brett.

“Brett Wilton” <bdwilton@xtra.co.nz> wrote in message
news:b8qccd$sun$1@inn.qnx.com

I seem to have the problem when a union with a defined name causes a
problem.

e.g. typedef struct {
union {
double a;
int b;
};
} Input;

I beleive this is allowed in C++ but not C. What are you using?

Input input;

input.a = 1.0;

Now I should be able to define a variable Input and access the a or b
structure members. However I get the errors,
warning: unnamed strcut/union that defines no instance
and
structure has no member named ‘a’



I can get around this by giving the union a name but really this should
work, and I have to change a mountain of code
that I’m trying to port. Is there a fix for this ? I believe I’m using QNX
Neutrino version 6.2.

Brett.

This has been fixed in the upcoming Patch to 6.2.1

Until then, could you do something funky like

typedef struct {
union un {
double a;
int b;
};
} Input;
#define a un.a

Brett Wilton <bdwilton@xtra.co.nz> wrote:

I seem to have the problem when a union with a defined name causes a
problem.

e.g. typedef struct {
union {
double a;
int b;
};
} Input;

Input input;

input.a = 1.0;

Now I should be able to define a variable Input and access the a or b
structure members. However I get the errors,
warning: unnamed strcut/union that defines no instance
and
structure has no member named ‘a’

I can get around this by giving the union a name but really this should
work, and I have to change a mountain of code
that I’m trying to port. Is there a fix for this ? I believe I’m using QNX
Neutrino version 6.2.

Brett.



cburgess@qnx.com

Do you have any idea when this patch will be available ?

“Colin Burgess” <cburgess@qnx.com> wrote in message
news:b8r714$627$2@nntp.qnx.com

This has been fixed in the upcoming Patch to 6.2.1

Until then, could you do something funky like

typedef struct {
union un {
double a;
int b;
};
} Input;
#define a un.a

Brett Wilton <> bdwilton@xtra.co.nz> > wrote:
I seem to have the problem when a union with a defined name causes a
problem.

e.g. typedef struct {
union {
double a;
int b;
};
} Input;

Input input;

input.a = 1.0;

Now I should be able to define a variable Input and access the a or b
structure members. However I get the errors,
warning: unnamed strcut/union that defines no instance
and
structure has no member named ‘a’

I can get around this by giving the union a name but really this should
work, and I have to change a mountain of code
that I’m trying to port. Is there a fix for this ? I believe I’m using
QNX
Neutrino version 6.2.

Brett.




\

cburgess@qnx.com