Subject: Re: packet capturing
To: None <>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-kern
Date: 01/21/2004 20:06:27
>> Actually, a "once" construct would do the trick nicely.
> Are we seriously suggesting C constructs for the kernel?  Does GCC 3
> already have this, or do you have reason to think the GCC maintainers
> buy it back?

C may not have it, but gcc has it already, assuming concurrency issues
can be ignored:

#define ONCE if (({ static int x = 0; int y; y=x; x=1; !y; }))



(Well, you may want less-likely-to-clash names than x or y, but aside
from that it should work.  You can use while instead of if if you're
concerned about dangling elses.)

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B