On Mon, 13 Aug 2001, Dave Mitchell wrote:
> Nicholas Clark <[EMAIL PROTECTED]> wrote:
> > Does this mean avoid:
> >
> > if (...) {
> >   ...
> > } else {
> >   ...
> > }
> >
> > and instead use:
> >
> > if (...) {
> >   ...
> > }
> > else
> > {
> >   ...
> > }
> >
> > If my interpretation of what it means is correct, why is the latter style
> > preferred over the former style?
>
> Don't ask me guv', I just work here.... :-)
> Or more to the point, I just cribbed it from Porting/patching.pod.
> A similar edict appears in pod/perlstyle.pod (although that refers to Perl,
> not C). Personally I have no objection to cuddling, but it appears frowned
> upon by the Perl community. If that community lets me know otherwise, I'll
> happily change it.
>
> I also assumed that this is allowed:
>
> }
> else {
>
>From reading the code in the Camel, and various code I've seen from
Tom C. (who I think was the principle contributor to the style
sections) this seems to be the convention that is being encouraged:

   if (condition) {
   }
   elsif (condition) {
   }
   else {
   }

I prefer it this way myself; I think the idea is to keep items with the
same logical indent at the same physical indent.

 --- Joe M.

Reply via email to