Re: [PATCH] iio: light: bh1750: Move static keyword to the front of declaration

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

 



Hello Jonathan,

Thank you for feedback.

[...]
> > drivers/iio/light/bh1750.c:64:1: warning:
> >   ‘static’ is not at beginning of declaration [-Wold-style-declaration]
[...]
> This one has me confused.  The warning seems to be false as static
> is at the beginning of the declaration....
> 
> Sure we "could" combine the declaration with the definition as you have
> done here, but that has nothing much to do with the warning.
[...]

I only moved the "static const" at the front, I haven't changed the
code as it's already has been a declaration and definition.  There is
no semicolon there and the original author put a newline to separate
things which makes it look as if these were separate.

Simple example based on the existing code:

  https://godbolt.org/z/hV4HP7

I hope this helps to illustrate the change in the patch.  I apologise
if my approach was incorrect.

As part of the patch I removed the newline in an aim to make it less
confusing to anyone who will read the code in the future.  Especially,
since it makes it a bit awkward to read and when using things like
grep.

Krzysztof



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux