[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <alpine.DEB.0.98.0704251937160.31620@sigma.j-a-k-j.com>
Date: Wed, 25 Apr 2007 19:42:16 -0400 (EDT)
From: "John Anthony Kazos Jr." <jakj@...-k-j.com>
To: Randy Dunlap <randy.dunlap@...cle.com>
cc: Richard Knutsson <ricknu-0@...dent.ltu.se>,
Jiri Bohac <jbohac@...e.cz>, akpm@...l.org,
linux-kernel@...r.kernel.org
Subject: Re: [RFC][PATCH] fix abs() macro to work with types wider than int
> > Can there even be any reason beyond unnecessary pedantics to have [l[l]]abs?
>
> See Paragraph 1 above. We do lots of functions in a manner that is
> like C (or libc) so that we don't confuse developers.
I have the perfect solution that includes compatibility while avoiding
stupidity.
Macro "abs" which evaluates its argument once and uses typeof().
#define labs(n) abs(n)
#define llabs(n) labs(n)
Leave that in the kernel for a year or two. At the end of that time, grep
the kernel to show that only two silly people actually use them. Change
those, and remove the aliases. Sense restored.
As far as I'm concerned, the only reason those functions exist like that
is because standard C doesn't support function overloading and doesn't
want to promote every argument to the biggest width and -also- can't
define it as a macro because there's no typeof() in standard C. So since
we do have it...
...and why do we want people hacking the kernel who get confused by a
single "abs" function? Isn't that quite a lot like saying "Do not use
hairdryer while sleeping."?
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists