Page 1 of 1

typedef struct

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

Re: typedef struct

Posted: 16 Dec 2018 14:29
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.

Re: typedef struct

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

Re: typedef struct

Posted: 16 Dec 2018 22:31
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

Re: typedef struct

Posted: 17 Dec 2018 11:35
by bastibart
Thanks PoltoS.