Re: question about __v annotation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <robin.randhawa@xxxxxxxxx> 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


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux