[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: struct member initialization
From: |
Paul Pluzhnikov |
Subject: |
Re: struct member initialization |
Date: |
Wed, 03 Jan 2007 07:24:08 -0800 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Jumbo Shrimp, linux) |
fernspaanakker@gmail.com writes:
> I also have a followup: What if the struct is anonymous? Can you still
> initialize then?
Post a complete example showing what you are trying to do.
> Example (made it more complicated by making it part of an anonymous
> union):
This creates an anonymous union which can't be used for anything.
As such, it is useless; and my "psychic powers" are too weak today
to deduce what your *actual* code looks like.
You probably are doing something like:
union {
uint strLen;
struct {
char localString[LOCALSTRINGSIZE];
ushort localStrLen;
};
} x;
[IOW you actually create a variable of the anonymous union type.]
If that's the case, you can still initialize all fields:
union { ... } x = {0); // zero-initilizes all fields
Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.