From: Ingo Oeser <ioe-lkml@rameria.de>
To: Karsten Wiese <annabellesgarden@yahoo.de>
Cc: Ingo Molnar <mingo@elte.hu>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ARCH_HAS_IRQ_PER_CPU avoids dead code in __do_IRQ()
Date: Sun, 7 Aug 2005 13:07:20 +0200 [thread overview]
Message-ID: <200508071307.26221.ioe-lkml@rameria.de> (raw)
In-Reply-To: <200508071225.21825.annabellesgarden@yahoo.de>
[-- Attachment #1: Type: text/plain, Size: 1476 bytes --]
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 #2: Type: application/pgp-signature, Size: 189 bytes --]
next prev parent reply other threads:[~2005-08-07 11:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-06 16:14 Karsten Wiese
2005-08-06 21:28 ` Ingo Oeser
2005-08-07 10:25 ` Karsten Wiese
2005-08-07 11:07 ` Ingo Oeser [this message]
2005-08-07 11:56 ` Karsten Wiese
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200508071307.26221.ioe-lkml@rameria.de \
--to=ioe-lkml@rameria.de \
--cc=annabellesgarden@yahoo.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®