This seems to be a false positive from clang - but how does a compiler
know for sure that a function (posix_spawnp) always initializes a
pointer argument when returning 0 ? Ok, it's written in the docs and we
know it but there is no syntax to tell the compiler exactly that.

That's why I vote for initializing 'child' to 0 as suggested below. It
seems to be good programming practice.

clang's warning:

spawn-pipe.c:364:34: warning: variable 'child' may be uninitialized when
used here [-Wconditional-uninitialized]
      register_slave_subprocess (child);
                                 ^~~~~
spawn-pipe.c:257:14: note: initialize the variable 'child' to silence
this warning
  pid_t child;
             ^
              = 0




With Best Regards, Tim


Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to