[lkml]   [2003]   [Mar]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] coding style addendum
Richard B. Johnson wrote:
> On Mon, 10 Mar 2003, Luben Tuikov wrote:
>>Someone may find this helpful and descriptive of how kernel code
>>should be developed.
> [SNIPPED...]
>>+ Make sure every module/subroutine hides something.
> This is not correct. Well known example:
> #include <math.h>
> double hypot(double x, double y) {
> return sqrt((x * x) + (y * y));
> }
> This subroutine hides nothing. It receives input parameters

It does hide something. It hides *the implementation* of
the function hypot().

In effect, elsewhere in your code you could have the explicit
... = sqrt((x * x) + (y * y));
... = hypot(x, y);

It's just eliminating (code) redundancy and duplication.

I.e. this addendum was meant on a more abstract/logical ground, thus the
name of the chapter.

> locally stored and therefore not hidden. Your rule would require
> the replication of three floating-point variables NotGood(tm).

This isn't really my rule. I didn't invent or came up with anything
new here.

Documentation/CodingStyle is remarkably similar to most of what
you'd find in [1], and those rules are more or less from that
same book.

Actually, the whole point of my posting the patch is the last rule,
since well thought out data representation makes or breaks the code.

[1] ``The Elements of Programming Style'' by Kernighan
and Plauger, 2nd ed, 1988, McGraw-Hill.


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:33    [W:0.038 / U:0.264 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site