svn 14567

Tito farmatito at tiscali.it
Mon Mar 20 20:35:25 UTC 2006


On Monday 20 March 2006 20:53, you wrote:
> On Monday 20 March 2006 2:40 pm, Tito wrote:
> > On Monday 20 March 2006 18:20, Rob Landley wrote:
> > > On Monday 20 March 2006 12:06 pm, Aurelien Jacobs wrote:
> > > > On Mon, 20 Mar 2006 11:07:08 -0500 Rob Landley <rob at landley.net> wrote:
> > > > > On Monday 20 March 2006 2:30 am, Tito wrote:
> > > > > > On Monday 20 March 2006 00:32, Rob Landley wrote:

snip 

> So if you need the comment, it's not self-documenting code.  So why not just 
> have a comment instead of a #define where you #define something just so you 
> can immediately use it exactly once?
> 
> That's the point I was trying to make.

So there are two different problems:

/* from <whatever.h> */   <--- This is needed to know where this constants came from.
#define DRINK_BEER		1876352098  <--- this is needed to improve the code readability
/* from <whatever_2.h> */
#define DRINK_WATER        1876352298

int main(int argc, chr **argv)
{
	int i = 0;
	int fd;

	fd = bb_xopen(argv[1], O_RDWR);
	
	while (i++ < 10) {
		ioctl(fd, ( i < 5) ? DRINK_BEER : DRINK_WATER);
		 /* The above is IMHO self explanatory, meanwhile this other one is not:
		ioctl(fd, ( i < 5) ? 1876352098 : 1876352298);
		By looking at it  I can't easily say if I need to drink the water first
		and the beer after or viceversa......
		*/
	}	
}

Ciao ,
Tito

> Rob



More information about the busybox mailing list