PERFORCE change 126745 for review

Constantine A. Murenin cnst at FreeBSD.org
Tue Sep 25 16:49:59 PDT 2007


On 25/09/2007 07:32, Oliver Fromme wrote:

> Constantine A. Murenin wrote:
>  > Hans Petter Selasky wrote:
>  > > Some things I have in mind:
>  > > 
>  > > Automatic __FBSDID() at top of C-files.
>  > > 
>  > > Automatic "static prototypes".
>  > > 
>  > > Automatic comments before every C-function is defined.
>  > > 
>  > > Automatic use of typedefs when declaring certain device method functions:
>  > > 
>  > > static device_attach_t my_attach;
>  > > 
>  > > Automatically reorder the code so that it follows generic device driver 
>  > > layout.
>  > 
>  > Automatic renaming of function names like hid_get_descriptor_from_usb() 
>  > and usbreq_get_report_descriptor() into something less wordy.
> 
> FWIW, I like those functions names.  As far as I can tell,
> they do not violate style(9), and I can't think of a good
> reason why verbose names should be forbidden.

They do -- take a look how calls to these functions were made in the 
original diff.  Now try to bring those calls to KNF -- good luck. :)

> Especially when I have to read parts of the kernel code
> which I'm not familiar with (happens sometimes), I really
> apreciate it if the name of a function clearly indicates
> what the function does, without having to wade through
> anouther screenful of unknown code ...

You are mistaking the role of documentation and function contracts with 
function names.

All non-local functions should have manual pages;  abusing function 
names does not bring you on the road to clarity.

Granted, in the original development it may be easier to use wordy 
names, but IMHO these names should be normalised shortly after the main 
development phase of the project is completed.  This is C after all, not 
Java. :-)

C.


More information about the p4-projects mailing list