On Tue, Aug 25, 2009 at 02:44:00AM +0000, David Holland wrote: | The style rules currently prohibit argument names in function | declarations. This is necessary for installed headers, because | otherwise legal but stupid things the user can do with cpp can cause | the declarations to blow up. | | However, outside of that context, argument names, or at least some | argument names, serve as a useful form of documentation. While the | "vp" in "struct vnode *vp" doesn't add much value, writing "unsigned | flags" instead of just "unsigned" is actually useful, and IMO it | should be, if anything, encouraged. | | Is this a good/bad idea? Should I propose specific text for | share/misc/style? I name prototype arguments where appropriate, for similar reasons to your example of "unsigned flags". I've used a variety of naming conventions, depending upon the local conventions. Sometimes knowing whether an argument is an "in" versus "out" versus "both" can be useful, although you can usually infer that a variable is input-only if it has const. Does using leading underscores in the names help with the cpp issue? Luke.
Attachment:
pgpWvnCrzYmJt.pgp
Description: PGP signature