9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: "Andrés Domínguez" <andresdju@gmail.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] Plan 9/plan9port coding conventions
Date: Fri, 13 Jan 2012 15:55:03 +0100	[thread overview]
Message-ID: <CADNhbx1f+dQzZykR6aGvxvQLWE1jZeHEDqymONFp=DvG1i0nzA@mail.gmail.com> (raw)
In-Reply-To: <86vcoif5f4.fsf@cmarib.ramside>

2012/1/11  <smiley@icebubble.org>:
>
> (1) For example, P9 code tends to use variable names like "i" and "j",
> where I would typically use self-documenting variable names like "row"
> and "col".  Variable names like "row" and "col" are much easier to
> search for (i.e., with a right-click), too.  Names like "i" and "j"
> (which occur in many identifiers) will generate many false positives.

I haven't written code for plan9, so this is my own taste about plan9
coding style.

for ( i=0; i < nrows; i++);

or

for (i=firstrow; i <= lastrow; i++);

"i" is only an iterator variable, as used in the sigma notation for summation.
What has meaning to me is the condition or initialization variable (nrows,
firstrow, lastrow...)

> (2) In functions, variables are often declared together in one
> paragraph, and then, later, initialized in another paragraph, as in:
>
>  int i;
>  char *s;
>
>  /* stuff */
>
>  i = 0;
>  s = nil;

This style looks standard.


Andrés



  parent reply	other threads:[~2012-01-13 14:55 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-11 18:41 smiley
2012-01-11 18:53 ` Richard Miller
2012-01-12 20:20   ` Yaroslav
2012-01-11 19:01 ` Jeremy Jackins
2012-01-11 20:37 ` Russ Cox
2012-01-11 20:45 ` erik quanstrom
2012-01-11 21:20 ` John Floren
2012-01-11 21:25   ` Russ Cox
2012-01-11 23:00   ` Iruatã Souza
2012-01-11 23:57     ` John Stalker
2012-01-12  1:33       ` Skip Tavakkolian
     [not found]       ` <CAJSxfmJdLV8NMJgMFPcqCP+=ZGe8k2U=PcdkpexwUzbcL442+Q@mail.gmail.c>
2012-01-12  2:53         ` erik quanstrom
2012-01-12 15:18 ` Comeau At9Fans
2012-01-12 17:56 ` Christian Neukirchen
2012-01-12 23:07   ` Skip Tavakkolian
2012-01-13 14:55 ` Andrés Domínguez [this message]
2012-01-16 10:02 ` faif
2012-01-16 11:04   ` John Stalker
2012-01-16 22:50 ` smiley
2012-01-16 22:57   ` andrey mirtchovski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CADNhbx1f+dQzZykR6aGvxvQLWE1jZeHEDqymONFp=DvG1i0nzA@mail.gmail.com' \
    --to=andresdju@gmail.com \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).