+CC Neil from other reply > From: Dumitrescu, Cristian > Sent: Monday, April 9, 2018 6:27 PM > To: Ananyev, Konstantin <konstantin.anan...@intel.com>; Van Haaren, Harry > <harry.van.haa...@intel.com>; Stephen Hemminger <step...@networkplumber.org>; > Singh, Jasvinder <jasvinder.si...@intel.com>; Richardson, Bruce > <bruce.richard...@intel.com> > Cc: dev@dpdk.org > Subject: RE: [dpdk-dev] [PATCH] table: fix build error with gcc 8 > > > > > > > If people think that this function conversion is not nice, it can be > reworked > > in multiple ways at the expense of API (but not ABI) change: > > > 1. Define the hash function field in the table parameter structure as > > opaque void * rather than 4-parameter version. > > > 2. Create a separate parameter structure just for this hash table type. > > > > Why just not define your f_hash member as a union: > > > > struct rte_table_hash_params { > > ... > > union { > > rte_table_hash_op_hash f_hash_4params; > > rte_hash_function f_hash_3_params; > > }; > > > > ? > > > > Yes, agreed, this is yet another way to handle this, thanks Konstantin.
Agree that this solution is a lot better than raw casting. The issue I have with casting is that it doesn't explicitly show that the signature is different, and that the code must be aware of that fact. With a union, at least the code explicitly states that there is a difference in signature, and that this is being handled by the code, so this looks a better solution. Neil proposed an alternative solution using a bit to indicate calling params in a separate reply - another possibility.