C struct construct question
Peter
plp-ysDPMY98cNQDDBjDh4tngg at public.gmane.org
Tue Apr 18 16:38:18 UTC 2006
On Tue, 18 Apr 2006, Lennart Sorensen wrote:
> I think it is creating a static contant structure named local_tech of
> type 'strict ast_channel_tech' and initializing the contants by
> specifying which members of the struct to set to what value. Given you
> use local_tech.type to access it, it makes sense to be allowed to do
> .type = type when initializing it.
You seem to be right. This compiles cleanly:
struct foo {
int a;
int b;
int c;
} foo;
static const struct foo bar = {
.a = 0,
.b = 1,
};
Hmm, 17 years of C and still finding new tricks ;-)
Peter
--
The Toronto Linux Users Group. Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml
More information about the Legacy
mailing list