[ovs-dev] [PATCH V2] feature: Create specific types for ofp and odp port
blp at nicira.com
Wed Jun 19 16:29:42 UTC 2013
On Wed, Jun 19, 2013 at 08:32:30AM -0700, Alex Wang wrote:
> On Tue, Jun 18, 2013 at 1:10 PM, Ben Pfaff <blp at nicira.com> wrote:
> > nl_attr_get_odp_port() and nl_msg_put_odp_port() functions might be
> > handy.
> Sure! honestly, it seems that I could not make the right decision on what
> to provide and
> what not to. Especially after adding so many utility functions
> (*htons,*hash, odp/ofp_to_u),
> more to learn ;D
It's a difficult balance. I am sure that other experienced
programmers would weigh the tradeoffs differently. In this case, I
think that the benefits of *_htons() (shorter code) are outweighed by
the cost of knowing what those functions do. If we already had lots
of *_htons() functions for other types around, so that it was obvious
what the new ones do, then I might think differently.
On the other hands, there are lots of nl_msg_put_*() and
nl_attr_get_*() functions that all follow a similar pattern, so it
seems reasonable to create another one that also follows that pattern,
because it doesn't make the programmer think much to figure out what
it very likely does.
More information about the dev