Messages in this thread | | | Subject | Re: [PATCH] macintosh: no need to initilise statics to 0 | From | Joe Perches <> | Date | Tue, 17 Aug 2021 11:05:24 -0700 |
| |
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.
| |