You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is not actually true that 'a * b; ' is illegal if both are types. It is actually legal to define, e.g., a structure member as the same name as an existing typedef name. See, e.g., C99 6.7.7 example 3:
EXAMPLE 3 The following obscure constructions
typedef signed int t;
typedef int plain;
struct tag {
unsigned t:4;
const t:5;
plain r:5;
};
declare a typedef name t with type signed int,atypedef name plain with type int, and a structure with three bit-field members, one named t that contains values in the range [0, 15], ...
As far as I can see. nearly all redeclarations in a different namespace or inner scope are allowed. The only exception I see is in 6.9.1 paragraph 6: "An identifier declared as a typedef name shall not be redeclared as a parameter."
Unfortunately, it seems breaking that last rule is not uncommon. So maybe if we could allow that to be a warning, it would be very helpful.
Thanks for cast!
Kevin
The text was updated successfully, but these errors were encountered:
It is not actually true that 'a * b; ' is illegal if both are types. It is actually legal to define, e.g., a structure member as the same name as an existing typedef name. See, e.g., C99 6.7.7 example 3:
EXAMPLE 3 The following obscure constructions
typedef signed int t;
typedef int plain;
struct tag {
unsigned t:4;
const t:5;
plain r:5;
};
declare a typedef name t with type signed int,atypedef name plain with type int, and a structure with three bit-field members, one named t that contains values in the range [0, 15], ...
As far as I can see. nearly all redeclarations in a different namespace or inner scope are allowed. The only exception I see is in 6.9.1 paragraph 6: "An identifier declared as a typedef name shall not be redeclared as a parameter."
Unfortunately, it seems breaking that last rule is not uncommon. So maybe if we could allow that to be a warning, it would be very helpful.
Thanks for cast!
Kevin
The text was updated successfully, but these errors were encountered: