lkml.org 
[lkml]   [2019]   [Sep]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] iio: light: bh1750: Move static keyword to the front of declaration
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

\
 
 \ /
  Last update: 2019-09-08 15:53    [W:0.045 / U:4.556 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site