From: Daniele Lugli <genlogic@inrete.it>
To: Mikael Pettersson <mikpe@csd.uu.se>, linux-kernel@vger.kernel.org
Subject: Re: unhappy with current.h
Date: Tue, 15 Oct 2002 22:29:32 +0200 [thread overview]
Message-ID: <3DAC7AAC.B81A406E@inrete.it> (raw)
In-Reply-To: 15788.8728.734070.225906@kim.it.uu.se
Mikael Pettersson wrote:
>
> Rik van Riel writes:
> > On Mon, 14 Oct 2002, Chris Wedgwood wrote:
> > > On Mon, Oct 14, 2002 at 09:46:08PM +0200, Daniele Lugli wrote:
> > >
> > > > I recently wrote a kernel module which gave me some mysterious
> > > > problems. After too many days spent in blood, sweat and tears, I found the cause:
> > >
> > > > *** one of my data structures has a field named 'current'. ***
> > >
> > > gcc -Wshadow
> >
> > Would it be a good idea to add -Wshadow to the kernel
> > compile options by default ?
>
> While I'm not defending macro abuse, please note that Daniele's problem
> appears to have been caused by using g++ instead of gcc or gcc -x c to
> compile a kernel module. Daniele's later example throws a syntax error
> in gcc, since the cpp output isn't legal C ...
>
> Hence I fail to see the utility of hacking in kludges for something
> that's not supposed to work anyway.
Yes i confess, i'm writing a kernel module in c++ (and i'm not the only
one).
Anyway my consideration was general and IMHO applies to C too. What is
the benefit of redefining commonly used words? I would say nothing
against eg #define _I386_current get_current(), but just #define current
get_current() seems to me a little bit dangerous. What is the limit?
What do you consider a bad practice? Would #define i j be tolerated?
I wouldn't like to open a discussion about using c++ for kernel modules
because i know that the large majority of kernel developers is against.
And in fact i had to make my own version of the kernel sources turning
all 'new' into 'nEw', 'class' into 'klass' and so on, but this last
problem was more subtle.
But let me at least summarize my poor-programmer-not-kernel-developer
point of view: at present the kernel if a mined field for c++ and i
understand it is not viable nor interesting for the majority to rewrite
it in a more c++-friendly way. But why not at least keep in mind, while
writing new stuff (not the case of current.h i see), that kernel headers
could be included by c++?
Regards, Daniele
next prev parent reply other threads:[~2002-10-15 20:23 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-10-14 19:46 unhappy with current.h Daniele Lugli
2002-10-14 19:52 ` David S. Miller
2002-10-14 20:18 ` Daniele Lugli
2002-10-14 20:24 ` Chris Wedgwood
2002-10-15 0:00 ` Rik van Riel
2002-10-15 1:05 ` Chris Wedgwood
2002-10-15 1:12 ` Murray J. Root
2002-10-15 14:11 ` Mikael Pettersson
2002-10-15 20:29 ` Daniele Lugli [this message]
2002-10-15 20:44 ` Alexander Viro
2002-10-15 21:01 ` Mikael Pettersson
2002-10-14 20:33 ` Richard B. Johnson
2002-10-14 20:33 ` David S. Miller
2002-10-14 20:37 ` Olivier Galibert
2002-10-15 18:31 ` Richard B. Johnson
2002-10-14 21:22 ` Daniele Lugli
2002-10-15 17:08 ` Richard B. Johnson
2002-10-14 20:45 ` Andi Kleen
2002-10-15 1:09 ` Chris Wedgwood
[not found] <20021014.161535.17120.336861@webmail4.nyc.untd.com>
2002-10-14 20:24 ` Daniele Lugli
-- strict thread matches above, loose matches on Subject: below --
2002-10-18 14:49 Jeffrey Lim
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=3DAC7AAC.B81A406E@inrete.it \
--to=genlogic@inrete.it \
--cc=linux-kernel@vger.kernel.org \
--cc=mikpe@csd.uu.se \
/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