Note: Please indicate the source when reprinting, all rights reserved.This is based solely on my own understanding,and if it conflicts with your principles and ideas, please forgive me and do not criticize.
Preliminary Notes
This article was published on 2015-12-29 19:22:14, and is now backed up and updated using MarkDown and image hosting. The original images have been downloaded from the CSDN image server. (BlogID=014)
Date: 2015.12.29
Environment Description
None
Introduction
None
Description
A long time ago, while looking at some code in the Linux kernel, I was very puzzled by something. That is
struct XXX{
void * (*xxx1)(void * a);
void * (*xxx2)(void *b);
};
struct XXX test{
.xxx1=xxx11;
.xxx2=xxx22;
};
void xxx11(void *a){
}
void xxx22(void *b){
}
In the above, the two lines of initialization code highlighted in red have always left me perplexed; I thought this special syntax only existed in Linux.
Now, inadvertently, I have finally discovered the source of this syntax.
That is: the structure initialization syntax in standard C.
This syntax comes from the C99 standard.
This is purely hand-typed, and there may be errors; corrections are welcome.
Postscript
None
References
None
Donations, subscriptions, favorites, bananas, coins, please follow the public account
Note: Please respect original work, if you dislike it, do not criticize.Note: Please indicate the source when reprinting, all rights reserved.If you have questions, please leave a message, and I will reply as soon as I see it.