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 » 16 Dec 2018 13:12

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: 4731
Joined: 26 Jan 2011 19:36

Re: typedef struct

Post by PoltoS » 16 Dec 2018 14:29

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 » 16 Dec 2018 17:09

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: 4731
Joined: 26 Jan 2011 19:36

Re: typedef struct

Post by PoltoS » 16 Dec 2018 22:31

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 » 17 Dec 2018 11:35

Thanks PoltoS.

Post Reply