[getdns-api] stdbool.h

Wiley, Glen gwiley at verisign.com
Wed Nov 20 22:00:26 CET 2013


On 11/20/13 11:37 AM, "Paul Hoffman" <paul.hoffman at vpnc.org> wrote:


>On Nov 20, 2013, at 7:50 AM, Willem Toorop <Willem at NLnetLabs.nl> wrote:
>
>> The current API includes stdbool.h, but has only one prototype that uses
>> the bool type:
>> 
>> getdns_return_t
>> getdns_context_create(
>>  getdns_context_t       *context,
>>  bool                   set_from_os
>> );
>> 
>> Why not use int instead of bool and loose the dependency on stdbool.h.
>> The API would become much more portable. I.e.:
>> 
>> getdns_return_t
>> getdns_context_create(
>>  getdns_context_t       *context,
>>  int                    set_from_os
>> );
>> 
>> I know from experience because ldns uses bool internal.  It needs quiet
>> a bit of autoconf magic to provide a safe alternative when it is not
>> available.  It has caused other problems as well; Struct members being
>> aligned differently for the library as for programs using the library,
>> because a difference in compiler options (i.e. is bool 1 byte or more).
>
>If stdbool.h is at all an operational hassle, using ints would be better.

I second the use of ints - this feels more "natural" to me.

>
>--Paul Hoffman
>
>_______________________________________________
>getdns-api mailing list
>getdns-api at vpnc.org




More information about the spec mailing list