[getdns-api] typedefs for structs

Wiley, Glen gwiley at verisign.com
Wed Nov 20 13:45:28 MST 2013


Consistency can make a big difference in ease of use for a C library.  I
tend to prefer to use struct types rather than typedefs as they are a
little more explicit in the code.

My vote is to lose the typedefs.
-- 
Glen Wiley
KK4SFV

Sr. Engineer
The Hive, Verisign, Inc.




On 11/20/13 10:30 AM, "Willem Toorop" <willem at nlnetlabs.nl> wrote:

>In the current API typedef for structs usage seems inconsistent.
>
>getdns_context_t is defined as pointer type: struct getdns_context_t *
>by typedef struct getdns_context_t *getdns_context_t;
>
>But the other structs (getdns_bindata, getdns_dict and getdns_list) just
>have an equally named alias for the struct:
>
>typedef struct getdns_bindata getdns_bindata;
>typedef struct getdns_dict getdns_dict;
>typedef struct getdns_list getdns_list;
>
>Furthermore, those typedefs are not used in the function prototypes at
>all whilst the getdns_context_t struct is used *only* by its typedef name.
>
>Is there a reason for this inconsistency?
>
>Personally I would prefer loosing the typedefs and use all struct types
>explicitly as structs in the API function prototypes.
>
>What do you think?
>_______________________________________________
>getdns-api mailing list
>getdns-api at vpnc.org




More information about the getdns-api mailing list