is `mixing declarations and code' allowed?
Greg KH
greg at kroah.com
Sat Jul 8 11:21:47 EDT 2017
On Sat, Jul 08, 2017 at 10:21:06PM +0800, Shiyao Ma wrote:
> Hi,
>
> One thing I feel very un-comfortable when writing kernel module code
> is the warning of `mixing declarations and code'.
>
> Is `mixing declarations and code' still frowned upon by kernel
> developers?
Yes. It is a bad idea to ever do this in C code for a lot of various
reasons.
> Or is it just a history burden that for some reason one can not mix
> `declarations and code'?
Nope, please do not do it, your kernel code has to build with no
compiler warnings for it to be acceptable.
thanks,
greg k-h
More information about the Kernelnewbies
mailing list