[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <15033.1165842882@redhat.com>
Date: Mon, 11 Dec 2006 13:14:42 +0000
From: David Howells <dhowells@...hat.com>
To: Jeff Garzik <jeff@...zik.org>
Cc: David Howells <dhowells@...hat.com>,
Akinobu Mita <akinobu.mita@...il.com>, torvalds@...l.org,
akpm@...l.org, linux-kernel@...r.kernel.org,
Al Viro <viro@...iv.linux.org.uk>
Subject: Re: Mark bitrevX() functions as const
Jeff Garzik <jeff@...zik.org> wrote:
> * overall, I agree with this type of change. several Linux lib functions
> could use this sort of annotation.
Yes. I just happened to notice bitrev.c at the end of my git pull and wondered
if it was what it sounded like...
> * I question its usefulness on static [inline] functions, because the compiler
> should be able to figure out side effects. have you examined before-and-after
> asm to see if the code generation changes for the inlined area?
It doesn't actually make any difference, but I think such functions should be
so marked anyway: it gives both the code writer and the compiler more
information (though they're both free to ignore it if they like).
> * naked __attribute__ is ugly. define something short and memorable in
> include/linux/compiler.h.
I'm not sure that's a good idea. You have to be careful not to cause confusion
with ordinary "const".
> * another annotation to consider is C99 keyword 'restrict'.
Indeed, though I presume you don't mean in this particular case...
David
-
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