Hi Karsten, On Sunday 07 August 2005 12:25, Karsten Wiese wrote: > With my proposal the > #if defined(ARCH_HAS_IRQ_PER_CPU) > .... > #endif > lets readers of __do_IRQ() immediately grasp: > "this block might not be compiled / depends an ARCH" > And you'll get compile error's using IRQ_PER_CPU on ie i386, > letting you immediately know, > that you've got to change something to be able to use IRQ_PER_CPU. > > That are advantages I think. That's a valid argument. But an if is an if for the reader. It is a conditional he has to be aware of and it usally has no idention, if it is just inside "#if" instead of "if ()". I have seen people seen missing "#if 0" [1] around code while reading it. Missing an normal if () is harder with proper idention. A normal conditional has also the advantage, that the compiler checks the code for syntactic and some semantic errors within it. In an "#if 0" you can basically write any plain text[2] and any error will go undetected, until it becomes an "#if 1". Since your define is true for most compilations out there, this argument is not very strong. Last argument: Many kernel developers -- including Linus -- don't like "#if" in C files and prefer them in headers. Their reasons might be similiar to my own. Regards Ingo Oeser [1] Let's just consider the values of the pre-processor symbols here, ok? [2] Pavel Machek used this already to combine Makefile and C file :-)
Attachment:
pgp6iTFnn3e7X.pgp
Description: PGP signature
- Follow-Ups:
- Re: [PATCH] ARCH_HAS_IRQ_PER_CPU avoids dead code in __do_IRQ()
- From: Karsten Wiese <[email protected]>
- Re: [PATCH] ARCH_HAS_IRQ_PER_CPU avoids dead code in __do_IRQ()
- References:
- [PATCH] ARCH_HAS_IRQ_PER_CPU avoids dead code in __do_IRQ()
- From: Karsten Wiese <[email protected]>
- Re: [PATCH] ARCH_HAS_IRQ_PER_CPU avoids dead code in __do_IRQ()
- From: Ingo Oeser <[email protected]>
- Re: [PATCH] ARCH_HAS_IRQ_PER_CPU avoids dead code in __do_IRQ()
- From: Karsten Wiese <[email protected]>
- [PATCH] ARCH_HAS_IRQ_PER_CPU avoids dead code in __do_IRQ()
- Prev by Date: Re: Getting rid of SHMMAX/SHMALL ?
- Next by Date: Re: overcommit verses MAP_NORESERVE
- Previous by thread: Re: [PATCH] ARCH_HAS_IRQ_PER_CPU avoids dead code in __do_IRQ()
- Next by thread: Re: [PATCH] ARCH_HAS_IRQ_PER_CPU avoids dead code in __do_IRQ()
- Index(es):