typedef struct

Discussion about Z-Uno product. Visit http://z-uno.z-wave.me for more details.
Post Reply
bastibart
Posts: 23
Joined: 12 Dec 2018 16:37

typedef struct

Post by bastibart »

Hi guys

I found another compiler problem:
The following won't compile:

typedef struct {
float val;
} t_Val;

t_Val V;



But it will when specifying a name in 'struct' namespace. (why is this required?)

typedef struct t_Val {
float val;
} t_Val;
User avatar
PoltoS
Posts: 7565
Joined: 26 Jan 2011 19:36

Re: typedef struct

Post by PoltoS »

From this good explanation it should be clear:
https://stackoverflow.com/questions/167 ... efinitions

We use our own uCxx translation from C++ to C, so we do not accept anonymous structures in typedef. We will think to fix it.
bastibart
Posts: 23
Joined: 12 Dec 2018 16:37

Re: typedef struct

Post by bastibart »

Hi there

Yes I read that too :-)
But it never happned to me that any compiler would require the syntax: typedef struct T {} T;

Anyway I guess there are more important things.
User avatar
PoltoS
Posts: 7565
Joined: 26 Jan 2011 19:36

Re: typedef struct

Post by PoltoS »

This is out of C standards. This is compiler specific. Some are more tolerant, some are not. We will check if it is hard to fix
bastibart
Posts: 23
Joined: 12 Dec 2018 16:37

Re: typedef struct

Post by bastibart »

Thanks PoltoS.
Post Reply