[ovs-dev] [PATCH] ofproto-dpif: xlate_actions() more judiciously.

Ben Pfaff blp at nicira.com
Tue Jun 7 18:31:50 UTC 2011


On Tue, Jun 07, 2011 at 11:25:53AM -0700, Jean Tourrilhes wrote:
> -    bool send_flow_removed;      /* Send a flow removed message? */
> +    int send_flow_removed:1,     /* Send a flow removed message? */
> +        has_resubmit:1;          /* Rule contains resubmit action. */

Leaving the rest of this patch aside for the moment (I think that
Ethan is planning to review it in detail), let me address this
specific part.  "int" bit-fields are a weird corner case in the C
standard, which says:

     ...for bit-fields, it is implementation-defined whether the
     specifier "int" designates the same type as "signed int" or the
     same type as "unsigned int".

This means that a 1-bit "int" bit-field might only be able to
represent the values -1 and 0.

My conclusion has always been that one should never use "int" as the
type of a bit-field member, only "unsigned int" (or "signed int", I
guess, but I've never had a need for a signed bit-field member).



More information about the dev mailing list