Re: What coding standard are you using for C?The



Andrew Smallshaw wrote:

On 2009-11-05, Paul Carpenter <paul@xxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:

Despite C, being free format, avoid too much free format, remembering
that at some time it may well be printed, 300 character lines wrap
very interestingly, if they wrap. Choosing indentation matching
can make following the code easier, even if you have managed
to get the function to fit on one page.

I keep getting criticism for ignoring an imagined 80 column limit.
Yes, I'll keep it under 132 columns but not 80 - it just gets too
restrictive and demands either less indentation of cyptically short
variable names which are a much bigger problem. 132 (sometimes
136) is of course how long a line can be printed on a wide carriage
printer, so it is largely historical now, although is does approximate
what enscript -r can fit on a *** of A4 with default settings.
With modern text editors under GUIs you are typically not limited
to anythign like 80 column views so I see no practical reason to
stick to such a narrow limit.


You would hate working to my standard then.

* There is a 64 character limit to the width
* There is a limit on how deep a structure can be
* There is a request that each sub-routine is kept within
16 lines but absolutely no longer than one page.
* It is also demanded that each subroutine has a description
of its function, the required input parameters and what the
expected output parameters.

Less important is the indent style but I do like a very clear layout that
highlights the structural integrity of the subroutines.

* Clear phrasing is expected.

Then, I code in Forth and by adopting my standard I am assured that I can
easily work through reviews and tests easily to fully certify the codes
correctness.

--
********************************************************************
Paul E. Bennett...............<email://Paul_E.Bennett@xxxxxxxxxxxxx>
Forth based HIDECS Consultancy
Mob: +44 (0)7811-639972
Tel: +44 (0)1235-510979
Going Forth Safely ..... EBA. www.electric-boat-association.org.uk..
********************************************************************

.


Quantcast