-1

I'm new to C and I understand that you define a function using this format

return_type function_name(args)
{
    ... body ...
}

But then I see this code from the kernel: https://github.com/torvalds/linux/blob/master/kernel/time/tick-broadcast.c#L995L1005

where a function definition looks like this:

void __init tick_broadcast_init(void)
{
    ... body ...
}

It looks like there's two variables, __init and tick_broadcast_init. Anyone know what's going on?

User314159
  • 7,733
  • 9
  • 39
  • 63
  • 1
    Between the return type and the function name there may be compiler-specific attributes (such as directives governing the section of the executable, the calling convention and other stuff). This is the case for `__init` (actually a macro which expands to several of these attributes). – Matteo Italia Oct 19 '15 at 00:17

1 Answers1

2

__init and tick_broadcast_init are not variables.

__init is a a macro see here for more explanations.

tick_broadcast_init is your function name.

Your return type is void meaning "nothing" so that there is in fact no data in return.

coincoin
  • 4,595
  • 3
  • 23
  • 47