Re: [cc65] Possible bug?

From: Adam Dunkels <adam1sics.se>
Date: 2004-06-10 08:36:22
On Thu, 2004-06-10 at 01:23, Groepaz wrote:
> On Wednesday 09 June 2004 23:29, Ullrich von Bassewitz wrote:
> 
> > 3. Use a do loop:
> >
> >     #define disable_irq(n)     	\
> > 	do { asm ("lda #$80"); asm ("trb $fd01+"#n"*4"); } while (0)
> 
> just curious, is there really a difference between
> 
>      #define disable_irq(n)     	\
>  	do { asm ("lda #$80"); asm ("trb $fd01+"#n"*4"); } while (0)
> 
> and
> 
>      #define disable_irq(n)     	\
> 	{ asm ("lda #$80"); asm ("trb $fd01+"#n"*4"); } 
> 
> ? i've seen the first variant a couple of times now, but always used
> the second one without problems ... so is there a reason to prefer the
> first? (can you show an example where the second wouldnt work?)

if(something()) 
  disable_irq(n);
else
  enable_irq(n);

This will give a syntax error because of the };else sequence.

/adam
-- 
Adam Dunkels <adam@sics.se>
http://www.sics.se/~adam/

----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Thu Jun 10 08:36:30 2004

This archive was generated by hypermail 2.1.8 : 2004-06-10 08:36:38 CEST