Hi Guennadi,

On Monday 19 September 2011 21:28:09 Guennadi Liakhovetski wrote:
> Hi Laurent
> 
> just one question:
> 
> On Mon, 19 Sep 2011, Laurent Pinchart wrote:
> > > diff --git a/drivers/media/video/mt9m032.c
> > > b/drivers/media/video/mt9m032.c new file mode 100644
> > > index 0000000..8a64193
> > > --- /dev/null
> > > +++ b/drivers/media/video/mt9m032.c
> > > @@ -0,0 +1,814 @@
> 
> [snip]
> 
> > > +static int mt9m032_read_reg(struct mt9m032 *sensor, const u8 reg)
> > 
> > No need for the const keyword, this isn't a pointer :-)
> 
> I was actually wondering about these: of course it's not the same as using
> const for a pointer to tell the compiler, that this function will not
> change caller's data. But - doesn't using const for any local variable
> tell the compiler, that that _variable_ will not be modified in this
> function? Are there no optimisation possibilities, arising from that?

I would expect the compiler to be smart enough to notice that the variable is 
never assigned. In practice, for such a small function, the generated code is 
identical with and without the const keyword.

-- 
Regards,

Laurent Pinchart
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to