Re: types, variable names and fields
- From: rlb@xxxxxxxxxxxxxxxxxxxxxx (Richard Bos)
- Date: Fri, 27 Jun 2008 06:49:33 GMT
SRoubtsov@xxxxxxxxx wrote:
Do you know whether ANSI C (or some other dialects) support the following:
It's ISO C these days, BTW.
* a variable name coincides with a type name,
No, that's not allowed.
* a structure/union field name coincides with a type name
in the same file (.c + all relevant .h's)?
That is allowed. It's also allowed for the struct type itself to have
the same name as another type or object, because the struct keyword
disambiguates between them.
typedef int m;
typedef struct a {
int i;
char m;
} b;
char *m
The typedef and the char * clash. The char field does not clash with
either of those. And if you'd called it struct m, that would not have
clashed with any of the others, either.
Richard
.
- References:
- types, variable names and fields
- From: SRoubtsov
- types, variable names and fields
- Prev by Date: Re: How to learn C ?
- Next by Date: Re: [OT] Can size_t be used as a substitute to unsigned long int ?
- Previous by thread: Re: types, variable names and fields
- Next by thread: Can size_t be used as a substitute to unsigned long int ?
- Index(es):
Relevant Pages
|