Messages in this thread | | | Date | Thu, 1 Nov 2012 12:43:01 +0100 | From | Borislav Petkov <> | Subject | Re: [PATCH 3/3] checkpatch: Emit a warning when decimal values are used |
| |
On Wed, Oct 31, 2012 at 03:49:08PM -0700, Andrew Morton wrote: > Joe means floating point. I suggest that the patchset be reworked, > using s/decimal/float/g. > > > The kernel does have floating point constants, in various graphics > drivers, iirc. They are used in places where the floatiness gets > handled at complation time. Along the lines of: > > int foo = 1.1 * 2.2; > > And I suppose that's an OK thing to do. We could instead do > > int foo = 2; /* 1.1 * 2.2 */ > > but that's taking away a programmer convenience for no good reason. > It would be highly inconvenient if the "1.1" was in fact a #define in > some other file, or a Kconfig string. > > > > That being said, I guess it's a worthwhile thing for checkpatch to warn > about. Hopefully the programmer will say "well thanks, but I meant to > do that". > > A much better solution would be to arrange for the kernel to fail to > compile (or to fail to link) if floats are used. That way, people > could continue to use floats within their compile-time scalar > expressions without getting harrassed by checkpatch. But I don't know > how to arrange this.
Run git grep on the source before compiling... Expensive though.
Also, Joe, I think you should add Andrew's explanation to the commit message so that it is clear what that check is for. Or maybe even as a comment above the check itself in checkpatch.pl.
Thanks.
-- Regards/Gruss, Boris.
| |