[BusyBox] uname patch and questions

David Schleef ds at schleef.org
Mon Nov 26 23:02:56 UTC 2001


On Mon, Nov 26, 2001 at 09:51:02PM -0700, Manuel Novoa III wrote:
> 
> > The only thing i would change would be to declare utsname_offset[],
> > options[] and flags[] inside uname_main() as that the only place they
> > are used. Is there a reason not to, or is it just aesthetics ?
> 
> Just my style really.  I tend to put static const tables outside of
> function definitions.

Here's some justification for your style:

int ack1(int x)
{
	const int array[10] = {1,2,3,4 };
	return array[x];
}

const int array[10] = {1,2,3,4 };
int ack2(int x)
{
	return array[x];
}

ack1 compiles to 100 bytes, not including the call to memcpy, vs.
ack2's 20 bytes.  (Compiled on PowerPC.)  If you make the first
one 'static const', they are the same -- although I don't trust
the compiler to get it right 100% of the time.



dave...






More information about the busybox mailing list