ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
i would think this typedef means that we can use another name for a pointer to an integer called initcall_t....what does the void do?
OR
is it a pointer to a function? why is there a typedef there in that case? is it typedef'ing' the integer that the function returns? what is the point of this?
i would very much appreciate a prompt reply!
Thank you!
initcall_t is a pointer to a function taking no arguments (void arg list) and returning an int. 'typedef'ing it makes it look like it is a native data type.
It is a pointer-to-function typedef, so that you can easily make code that takes one of them without trying to deal with the tough and possibly confusing syntax. All you need to do is declare things with that type, which is a lot simpler than if you had to do it the hard way everywhere.
## is used to textually concatenate two things together, usually one (or both) of them a parameter. Say you want to make one long string out of a parameter and a fixed value. In the macro definition, you can use "a_long_ ## param". If param is "foo" the result is "a_long_foo" or if param is "bar" you get "a_long_bar". See the CPP documentation for details.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.