The purpose of the macro is served even without the last __v; statement. But
the last statement __v; enables the macro to be used as rvalue (as described
in many replies) in an expression.

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 <[email protected]>wrote:

> On Sun, Jan 03, 2010 at 11:49:09AM -0500, Anand Arumugam wrote:
> >    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.
>
> That's incorrect. The GNU C literature states that a compound statement
> 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
>

Reply via email to