avr-libc-dev
[Top][All Lists]
Advanced

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

Re: [avr-libc-dev] Deprecation policy [was: Re: [RFC][PATCH] Deprecate


From: Russell Shaw
Subject: Re: [avr-libc-dev] Deprecation policy [was: Re: [RFC][PATCH] Deprecate inb / outb.]
Date: Mon, 16 Jun 2003 12:37:23 +1000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20030311 Debian/1.2.1-10

Dmitry K. wrote:
16 Jun 2003 11:45 Russell Shaw wrote:

Dmitry K. wrote:

16 Jun 2003 06:18 Joerg Wunsch wrote:

Basically, it's now no longer (easily) possible to use one
of the SFRs as the target of an inline asm statement anyway (see bug
ID #2233, we need to update our inline asm docs accordingly).

Examples of SFRs usage:

//#define _SFR_ASM_COMPAT  1    /* needed for second example only       */

#include <avr/io.h>

/* Examples of SFRs as the target of an inline asm statements.
  For qualitative realization it is necessary to add check:
        if (__builtin_constant_p((port)))
*/
#define cbi_atomic(port,bit)    do {                    \
...
} while (0)

What is the do{...} while(0) for?


I shall specify, superfluous here only internal brackets. Removal
"do ... while" is undesirable, as, for example, it will be impossible to write:
        if (flag)
                cbi_atomic(PORTB, 2);   /* excess ';'   */
        else
==>  parse error before "else"

Hi,
The reason i asked is that why couldn't just the curly brackets
be used like:

  #define cbi_atomic(port,bit)    {                    \
  ...
  }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]