Back in the mists of time (May 29th), I solicited comments on my second
draft of the deeply thrilling "Conventions and Guidelines for Perl
Source Code". There were various contributions, but having more interesting
things to do [watching paint dry etc - Ed], I never got round to incorporating
them. Here's a quick summary of what I think passed for a consensus; if
if no one has any violent last-minute objections, I'll add these to the
final doc.


* indentation should consist only of spaces (no tabs).

* tabs elsewhere should be assumed to expand on an 8-char boundary.

* internal data types and their utility functions 
(*especially* for strings) should be used over a bare char * whenever 
possible. Ideally there should be no char * in the source anywhere,
and no use of C's standard string library.

* add the appropriate magic at the bottom of each src file to make emacs,
vim etc Do The Right Thing indent-wise ???? - (this was suggested but not
discussed)
[ Russ - you offered to provide the incantations ... ]

Extra 'should' style guidelines [Hugo]
- binary operators should have a space on either side;
- parentheses should not have space immediately after the opening paren
  nor immediately before the closing paren
- commas should have space after but not before
.. giving:
  x = (a + b) * f(c, d / e);
  
-  long lines should be split *before* an operator so that it is immediately
obvious when scanning the LHS of the code that this has happened - and 2
extra levels of indent should be used.
- and/or split on matching parens, with the content on separate line(s) and
with one extra indent:

    do_arbitrary_function(
        list_of_parameters_with_long_names, or_complex_subexpression(
            of_more_params, or_expresssions + 1
        )
   );


- portability:

* Dont assume GNU C, and dont use any GNU extensions unless protected by
#ifdefs for non-GNU-C builds.

Reply via email to