9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Don Bailey <don.bailey@gmail.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@cse.psu.edu>
Subject: Re: [9fans] Function args not checked
Date: Mon, 17 Apr 2006 14:43:13 -0600	[thread overview]
Message-ID: <3b9009a1d7e95196538ff9a7b2e8e7fe@gmail.com> (raw)
In-Reply-To: <536d93713f9b4b3342371dc409ee1545@9netics.com>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

> variable naming conventions are not enforced by the compiler; they
> could be misleading.  why not use an ide - e.g.  eclipse is available
> for many platforms - or just document the code.  using cweb will
> exhibit your STRONG commitment to good documentation :)
>

I used to have a problem deciding how to keep track of
IN and OUT arguments in functions. Rather than bothering
to clutter up prototypes with names, I came up with this
simple technique:

	for
		anyfunction(IN * A, IN * B, IN * C, OUT * A)

Variables used as input to the given function will be sent
first, in alphabetical order by type. Output variables will be
sent next, alphabetically by type.

Thus,
	str->dup(char *, char ** );

Even without the second indirection giving us an obvious
clue, we know that the first variable is input and the second
is output.

Because I stick to this as a strict part of my API, I never have
to check the source to remind myself what I'm doing.

Just thought I'd give my two cents.

Don "north" Bailey



-----BEGIN PGP SIGNATURE-----
Version: PGP Desktop 9.0.6 (Build 6060)

iQA/AwUBREP94V/Ie1ANMtLuEQIVtQCfVWiWpqI6Tm0/mhhGFYGw82vPdJMAn24k
t6Kdoj1SWPR9iuSEGOc1/NGd
=6JoQ
-----END PGP SIGNATURE-----



  reply	other threads:[~2006-04-17 20:43 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-17  6:50 Rodolfo (kix)
2006-04-17  7:00 ` geoff
2006-04-17  7:25   ` Rodolfo (kix)
2006-04-17 14:52 ` jmk
2006-04-17 15:17   ` "Nils O. Selåsdal"
2006-04-17 15:28     ` David Leimbach
2006-04-17 15:31       ` jmk
2006-04-17 15:40         ` Paul Lalonde
2006-04-17 16:30           ` Skip Tavakkolian
2006-04-17 20:43             ` Don Bailey [this message]
2006-04-17 15:53   ` Victor Nazarov
2006-04-17 16:00     ` Devon H. O'Dell

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=3b9009a1d7e95196538ff9a7b2e8e7fe@gmail.com \
    --to=don.bailey@gmail.com \
    --cc=9fans@cse.psu.edu \
    /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).