qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 6/8] qemu:virtio-net: Enable filtering based


From: Paul Brook
Subject: Re: [Qemu-devel] [PATCH v2 6/8] qemu:virtio-net: Enable filtering based on MAC, promisc, broadcast and allmulti
Date: Tue, 3 Feb 2009 23:35:46 +0000
User-agent: KMail/1.9.9

> >>  +    static uint8_t bcast[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
> >
> > 'const'?
>
> It may be good practice but practically speaking, I don't think it will
> generate different code.  The only thing that uses bcast is memcmp()
> which should be a builtin.  Since bcast doesn't otherwise escape the
> function, it's an obvious candidate for optimization.  I think the
> compiler already has enough information that const doesn't tell it
> anything more.

const is as much for the programmer as the compiler[1]. Modifying this 
variable is just plain wrong, so it's a good idea to let the compiler enforce 
that.

Paul

[1] In many cases (especially when combined with pointers) "const" doesn't 
actually mean what may people think it does. Ask your local C language expert 
if you don't know what I'm talking about.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]