@maskit - I think it's a rather unreasonable requirement that any new utility 
be able to handle every possible case. My view is every reduction of using the 
C preprocessor is a good thing and therefore a utility that enables that in 
many cases is valuable, even if it doesn't cover all such uses.

As for the inconsistency, that's only a style issue. You could just as easily 
wrap the `#ifdef` code in a wrapper function. E.g. in this case use `#ifdef` to 
define the contents of `TS_SSL_CTX_set1_group_list`. I've always preferred that 
style, because it moves implementation details out of the way of the main code 
path, as with `ink_strlcpy`.

Handling the multiple feature case turns out to be easy in most cases as well. 
Because of the abuse of the comma operator in the `decltype`, there's no limit 
on how many expressions can be checked in one case. If three are needed, all 
three can be checked in the same case.

This utility originally came from work I am doing on upgrading the IP address 
support code in `ink_inet.h`.  I wanted to get rid of the [ugly code about 
setting the socket 
length](https://github.com/apache/trafficserver/blob/92b67e46727ca685b396afa8ef8093297ef601e9/lib/ts/ink_inet.h#L726).
 I did a version of this as a one off to make a `set_sockaddr_len` function. 
Afterwards I realized I could use this in other similar circumstances and made 
this more generic form of the code. I'm still exploring use cases and I thought 
the particular one under discussion was a nice one.

[ Full content available at: https://github.com/apache/trafficserver/pull/4140 ]
This message was relayed via gitbox.apache.org for [email protected]

Reply via email to