libpcp / pcp

PCP client library
BSD 2-Clause "Simplified" License
69 stars 30 forks source link

Not supplying the 2nd argument of pop_init generates compile error #20

Closed casouri closed 6 years ago

casouri commented 6 years ago

Code:

  pcp_ctx_t *pcpCTX = pcp_init(ENABLE_AUTODISCOVERY);

Error:

pcp.c:6:52: error: too few arguments to function call, expected 2, have 1
  pcp_ctx_t *pcpCXT = pcp_init(ENABLE_AUTODISCOVERY);
                      ~~~~~~~~                     ^

But in pcp.h the second argument is marked optional.

Did I miss something here?

ptatrai commented 6 years ago

Since C doesn't support default values for arguments, you have to pass 2 arguments. When you don't want to pass socket_vt pointer, just pass NULL. I've updated pcp_init description to include this information.