On Sun, 15 Aug 2021 at 15:34, Philippe Mathieu-Daudé <phi...@redhat.com> wrote: > > On 8/13/21 8:30 PM, Eric Blake wrote: > > FWIW, the POSIX wording is interesting - it requires portable > > applications to zero out sockaddr_in6 (and even states that memset() > > is not yet a portable way to do that on exotic hardware, although a > > future version of POSIX may add a zero-bit constraint on > > implementations; in practice we only use qemu on hardware where > > memset() to zero properly sets pointers to NULL and floating points to > > 0.0). > > So this checkpatch.pl error (inherited from Linux) is against POSIX? > > 2028 # check for static initialisers. > 2029 if ($line =~ /\bstatic\s.*=\s*(0|NULL|false)\s*;/) { > 2030 ERROR("do not initialise statics to 0 or NULL\n" . > 2031 $herecurr); > 2032 }
That one is for statics, where the C spec says you get 0-init by default and so there's no need to explicitly 0-init. -- PMM