home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 8
/
FreshFishVol8-CD2.bin
/
bbs
/
gnu
/
libg++-2.6.2.lha
/
libg++-2.6.2
/
etc
/
standards.info-1
(
.txt
)
< prev
next >
Wrap
GNU Info File
|
1994-12-15
|
49KB
|
937 lines
This is Info file standards.info, produced by Makeinfo-1.55 from the
input file ./standards.texi.
START-INFO-DIR-ENTRY
* Standards: (standards). GNU coding standards.
END-INFO-DIR-ENTRY
GNU Coding Standards Copyright (C) 1992, 1993, 1994 Free Software
Foundation
Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
preserved on all copies.
Permission is granted to copy and distribute modified versions of
this manual under the conditions for verbatim copying, provided that
the entire resulting derived work is distributed under the terms of a
permission notice identical to this one.
Permission is granted to copy and distribute translations of this
manual into another language, under the above conditions for modified
versions, except that this permission notice may be stated in a
translation approved by the Free Software Foundation.
File: standards.info, Node: Top, Next: Reading Non-Free Code, Prev: (dir), Up: (dir)
Version
*******
Last updated 28 March 1994.
* Menu:
* Reading Non-Free Code:: Referring to Proprietary Programs
* Contributions:: Accepting Contributions
* Change Logs:: Recording Changes
* Compatibility:: Compatibility with Other Implementations
* Makefile Conventions:: Makefile Conventions
* Configuration:: How Configuration Should Work
* Source Language:: Using Languages Other Than C
* Formatting:: Formatting Your Source Code
* Comments:: Commenting Your Work
* Syntactic Conventions:: Clean Use of C Constructs
* Names:: Naming Variables and Functions
* Using Extensions:: Using Non-standard Features
* System Functions:: Portability and "standard" library functions
* Semantics:: Program Behavior for All Programs
* Errors:: Formatting Error Messages
* Libraries:: Library Behavior
* Portability:: Portability As It Applies to GNU
* User Interfaces:: Standards for Command Line Interfaces
* Documentation:: Documenting Programs
* Releases:: Making Releases
File: standards.info, Node: Reading Non-Free Code, Next: Contributions, Prev: Top, Up: Top
Referring to Proprietary Programs
*********************************
Don't in any circumstances refer to Unix source code for or during
your work on GNU! (Or to any other proprietary programs.)
If you have a vague recollection of the internals of a Unix program,
this does not absolutely mean you can't write an imitation of it, but
do try to organize the imitation internally along different lines,
because this is likely to make the details of the Unix version
irrelevant and dissimilar to your results.
For example, Unix utilities were generally optimized to minimize
memory use; if you go for speed instead, your program will be very
different. You could keep the entire input file in core and scan it
there instead of using stdio. Use a smarter algorithm discovered more
recently than the Unix program. Eliminate use of temporary files. Do
it in one pass instead of two (we did this in the assembler).
Or, on the contrary, emphasize simplicity instead of speed. For some
applications, the speed of today's computers makes simpler algorithms
adequate.
Or go for generality. For example, Unix programs often have static
tables or fixed-size strings, which make for arbitrary limits; use
dynamic allocation instead. Make sure your program handles NULs and
other funny characters in the input files. Add a programming language
for extensibility and write part of the program in that language.
Or turn some parts of the program into independently usable
libraries. Or use a simple garbage collector instead of tracking
precisely when to free memory, or use a new GNU facility such as
obstacks.
File: standards.info, Node: Contributions, Next: Change Logs, Prev: Reading Non-Free Code, Up: Top
Accepting Contributions
***********************
If someone else sends you a piece of code to add to the program you
are working on, we need legal papers to use it--the same sort of legal
papers we will need to get from you. *Each* significant contributor to
a program must sign some sort of legal papers in order for us to have
clear title to the program. The main author alone is not enough.
So, before adding in any contributions from other people, tell us so
we can arrange to get the papers. Then wait until we tell you that we
have received the signed papers, before you actually use the
contribution.
This applies both before you release the program and afterward. If
you receive diffs to fix a bug, and they make significant change, we
need legal papers for it.
You don't need papers for changes of a few lines here or there, since
they are not significant for copyright purposes. Also, you don't need
papers if all you get from the suggestion is some ideas, not actual code
which you use. For example, if you write a different solution to the
problem, you don't need to get papers.
I know this is frustrating; it's frustrating for us as well. But if
you don't wait, you are going out on a limb--for example, what if the
contributor's employer won't sign a disclaimer? You might have to take
that code out again!
The very worst thing is if you forget to tell us about the other
contributor. We could be very embarrassed in court some day as a
result.
File: standards.info, Node: Change Logs, Next: Compatibility, Prev: Contributions, Up: Top
Change Logs
***********
Keep a change log for each directory, describing the changes made to
source files in that directory. The purpose of this is so that people
investigating bugs in the future will know about the changes that might
have introduced the bug. Often a new bug can be found by looking at
what was recently changed. More importantly, change logs can help
eliminate conceptual inconsistencies between different parts of a
program; they can give you a history of how the conflicting concepts
arose.
Use the Emacs command `M-x add-change' to start a new entry in the
change log. An entry should have an asterisk, the name of the changed
file, and then in parentheses the name of the changed functions,
variables or whatever, followed by a colon. Then describe the changes
you made to that function or variable.
Separate unrelated entries with blank lines. When two entries
represent parts of the same change, so that they work together, then
don't put blank lines between them. Then you can omit the file name
and the asterisk when successive entries are in the same file.
Here are some examples:
* register.el (insert-register): Return nil.
(jump-to-register): Likewise.
* sort.el (sort-subr): Return nil.
* tex-mode.el (tex-bibtex-file, tex-file, tex-region):
Restart the tex shell if process is gone or stopped.
(tex-shell-running): New function.
* expr.c (store_one_arg): Round size up for move_block_to_reg.
(expand_call): Round up when emitting USE insns.
* stmt.c (assign_parms): Round size up for move_block_from_reg.
It's important to name the changed function or variable in full.
Don't abbreviate them; don't combine them. Subsequent maintainers will
often search for a function name to find all the change log entries that
pertain to it; if you abbreviate the name, they won't find it when they
search. For example, some people are tempted to abbreviate groups of
function names by writing `* register.el ({insert,jump-to}-register)';
this is not a good idea, since searching for `jump-to-register' or
`insert-register' would not find the entry.
There's no need to describe the full purpose of the changes or how
they work together. It is better to put such explanations in comments
in the code. That's why just "New function" is enough; there is a
comment with the function in the source to explain what it does.
However, sometimes it is useful to write one line to describe the
overall purpose of a large batch of changes.
You can think of the change log as a conceptual "undo list" which
explains how earlier versions were different from the current version.
People can see the current version; they don't need the change log to
te