[OCLUG-devel] one more question about structures...
Christopher Smith
x at xman.org
Sat Jun 19 18:49:09 PDT 2004
On Sat, 2004-06-19 at 18:32, James Colannino wrote:
> Ok, I have one more question about structures... I hope that these
> three messages I've sent to the group in the past 30 minutes or so
> haven't gotten annoying. I haven't seen any activity on the oclug-devel
> list lately, so I'm hoping that at least people will be happy that
> there's some traffic :-P
>
> This isn't about anything going wrong. I'm just curious about a benign
> compiler warning that I'm getting. Consider the following code:
>
> #include <stdio.h>
>
> int main()
>
> {
> struct time {
> unsigned short int hour;
> unsigned short int min;
> };
>
> struct date_time {
> unsigned short int month; /* 1-12 */
> unsigned short int day; /* 1-31 */
> unsigned short int year;
>
> struct time time_of_day;
> } date;
>
> date.time_of_day.hour = 1;
>
> return 0;
> }
>
> Whenever I assign a value to a nested structure, I get the following
> warning from the compiler:
>
> warning: declaration does not declare anything
Hmm... shouldn't it be:
typedef struct date_time {
/* stuff */
} date;
Does that make the compiler warning go away?
--
Christopher Smith <x at xman.org>
More information about the OCLUG-devel
mailing list