Without the last statement __v; at the end of the macro the compiler will issue a warning/error for the unused variable __v within the scope defined by { ... } and an error if the macro is used as rvalue.
cheers,
anand.
On Mon, Jan 4, 2010 at 3:21 PM, Robin Randhawa <robin.randhawa@xxxxxxxxx> wrote:
On Sun, Jan 03, 2010 at 11:49:09AM -0500, Anand Arumugam wrote:That's incorrect. The GNU C literature states that a compound statement
> I think the last __v; inside the macro is to avoid compiler warning or
> error that the unsigned 8-bit variable __v is not being used inside the
> scope defined by the macro.
enclosed in parentheses may appear as an _expression_.
As a previous poster pointed out, the expansion of the readb macro is a
compound statement which is surrounded by parentheses and is therefore an
_expression_ that evaluates to the value of the last subexpression in the
compound statement : in this case the value of __v.
See <http://gcc.gnu.org/onlinedocs/gcc/Statement-Exprs.html> for more
information.
Cheers,
Robin