On Fri, Jul 12, 2019 at 04:20:06PM +0000, Van Haaren, Harry wrote:
> > The sizeof operator is unique among C operators in that it accepts two
> > very different kinds of operands: an expression or a type. In general,
> > prefer to specify an expression, e.g. int *x = xmalloc(sizeof *x);. When
> > the operand of sizeof is an expression, there is no need to parenthesize
> > that operand, and please don't.
> 
> Hmmm, I get compile failures here with "sizeof uint64_t" instead of 
> "sizeof(uint64_t)".
> There's also some ambiguity possible, see here: 
> https://stackoverflow.com/a/26702432
> 
> In short, I've left the sizeof() with brackets, as code that compiles wins in 
> the end.

uint64_t is an example of a type rather than an expression.  With a
type, the parentheses are required.
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to