Yes, it is legitimate C, and it can be useful in rare cases, for example, if you have a simple C source file (not for POSIX) that uses wait with a static link to function it and suddenly realize that you need to call POSIX wait from the function in this file. By defining the declaration in the function that calls it, you avoid contradicting the definition of static to determine the scope of static .
Note that pid_t can be obtained from other headers that do not declare wait (or any functions), but in other cases you will not be able to use a trick like this due to the lack of types.
And yes, some may call it a terrible hacking / abuse of the language. :-)
source share