C struct construct question
Lennart Sorensen
lsorense-1wCw9BSqJbv44Nm34jS7GywD8/FfD2ys at public.gmane.org
Tue Apr 18 15:06:39 UTC 2006
On Tue, Apr 18, 2006 at 09:50:12AM +0300, Peter wrote:
>
> Hi all,
>
> I found an unusual C construct in Asterisk source code and I am looking
> for an explanation. Of course I cannot find one online. Here is a quote:
>
> static const struct ast_channel_tech local_tech = {
> .type = type,
> .description = tdesc,
> .capabilities = -1,
> .requester = local_request,
> .send_digit = local_digit,
> .call = local_call,
> .hangup = local_hangup,
> .answer = local_answer,
> .read = local_read,
> .write = local_write,
> .exception = local_read,
> .indicate = local_indicate,
> .fixup = local_fixup,
> .send_html = local_sendhtml,
> };
>
> how does this work ? References ?
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.
Len Sorensen
--
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