[ovs-dev] [nxm 22/42] ofp-util: Add macros for composing error codes.
Ben Pfaff
blp at nicira.com
Fri Nov 5 16:25:15 UTC 2010
On Thu, Nov 04, 2010 at 05:55:06PM -0700, Justin Pettit wrote:
> On Oct 28, 2010, at 10:27 AM, Ben Pfaff wrote:
>
> > +/* These are macro versions of the functions defined below. The macro versions
> > + * are intended for use in contexts where function calls are not allowed,
> > + * e.g. static initializers and case labels. */
> > +#define OFP_MKERR(TYPE, CODE) ((1 << 30) | ((TYPE) << 16) | (CODE))
> > +#define OFP_MKERR_VENDOR(VENDOR, TYPE, CODE) \
> > + ((1 << 30) | ((VENDOR) << 26) | ((TYPE) << 16) | (CODE))
> > +#define OFP_MKERR_NICIRA(TYPE, CODE) \
> > + OFP_MKERR_VENDOR(OFPUTIL_VENDOR_NICIRA, TYPE, CODE)
>
> Is it worth putting those last "TYPE" and "CODE" in parentheses?
I don't think there is any way to get a non-parenthesized comma into a
macro argument, so this should be safe.
Thanks,
Ben.
More information about the dev
mailing list