Re: [PATCH] macintosh: no need to initilise statics to 0

From: Joe Perches
Date: Tue Aug 17 2021 - 14:05:54 EST


On Tue, 2021-08-17 at 13:59 +0200, Christophe Leroy wrote:
>
> Le 17/08/2021 à 13:51, Jason Wang a écrit :
> > Global static variables dont need to be initialised to 0. Because
> > the compiler will initilise them.
>
> It is not the compiler, it is the Kernel. It is done here:
>
> https://elixir.bootlin.com/linux/v5.14-rc6/source/arch/powerpc/kernel/early_32.c

I don't know why that's done generally.

>From memory, it's also required by the c spec unless it's for a union
where the first union member is smaller in size than other members.