[C function]__init

In C language,__init is a special tag, usually used in kernel module programming.

** It is used to indicate that a function will be called during the system initialization phase. **Specifically,When a system starts, all functions marked with __init will be automatically called to perform necessary initialization operations.

These functions are usually usedto set global variables, allocate memory, open devices, set interrupts, etc..

Once the system is up and running, these functions will not be called again. Therefore, they are usually located in the kernel or module's initialization code.

It should be noted that the **__init tag is not only used for functions, but also for variables. **Variables marked with __init will be assigned a default value during system initialization.

However, I must point out that this explanation is based on the background of Linux kernel programming.

In other contexts, __init may have a different meaning or not exist at all. Therefore, if you are programming in a non-kernel environment, this explanation may not apply.

Guess you like

Origin blog.csdn.net/weixin_45264425/article/details/134645578