Multiple choice

/* sys/cdef.h / #if defined(STDC) || defined(__cplusplus) #define __P(protos) protos #else #define __P(protos) () #endif / stdio.h */ #include <sys/cdefs.h> div_t div __P((int, int));

The code above comes from header files for the FreeBSD implementation of the C library. What is the primary purpose of the __P() macro?

  1. The __P() macro has no function, and merely obfuscates library function declarations. It should be removed from further releases of the C library.

  2. The __P() macro provides forward compatibility for C++ compilers, which do not recognize Standard C prototypes.

  3. Identifiers that begin with two underscores are reserved for C library implementations. It is impossible to determine the purpose of the macro from the context given.

  4. The __P() macro provides backward compatibility for K&R C compilers, which do not recognize Standard C prototypes.

  5. The __P() macro serves primarily to differentiate library functions from application-specific functions.

Reveal answer Fill a bubble to check yourself
D Correct answer