tcpdump mailing list archives
Re: PCAP_ERROR/PCAP_ERROR_BREAK or -1/-2?
From: Guy Harris <gharris () sonic net>
Date: Wed, 25 Jul 2018 01:11:23 -0700
On Jul 25, 2018, at 12:57 AM, Denis Ovsienko <denis () ovsienko info> wrote:
Roughly a half of the libpcap man pages text uses the values -1 and -2 to discuss the return value of particular libpcap functions, the other half uses PCAP_ERROR and PCAP_ERROR_BREAK. Is there a good reason to keep it this way instead of using PCAP_ERROR/PCAP_ERROR_BREAK consistently in all man pages?
About the only reason for *code* not to use PCAP_ERROR and PCAP_ERROR_BREAK would be if it has to compile with versions
of libpcap prior to 1.0.
The only reason not to use PCAP_ERROR and PCAP_ERROR_BREAK in man pages for APIs existing in pre-1.0 releases would be
to discourage people from writing code that wouldn't compile with pre-1.0 releases.
However, they could *also* just do
#ifndef PCAP_ERROR
#define PCAP_ERROR -1
#endif
#ifndef PCAP_ERROR_BREAK
#define PCAP_ERROR_BREAK -2
#endif
in the files that use them with those APIs, or in a header file included by those files, so I'm not sure that's a
strong enough reason not to just use them uniformly.
And if they're making calls to APIs *not* present in pre-1.0 releases, their code won't compile with a pre-1.0 release
anyway, so....
_______________________________________________
tcpdump-workers mailing list
tcpdump-workers () lists tcpdump org
https://lists.sandelman.ca/mailman/listinfo/tcpdump-workers
Current thread:
- PCAP_ERROR/PCAP_ERROR_BREAK or -1/-2? Denis Ovsienko (Jul 25)
- Re: PCAP_ERROR/PCAP_ERROR_BREAK or -1/-2? Guy Harris (Jul 25)
- Re: PCAP_ERROR/PCAP_ERROR_BREAK or -1/-2? Denis Ovsienko (Jul 25)
- Re: PCAP_ERROR/PCAP_ERROR_BREAK or -1/-2? Guy Harris (Jul 25)
