X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=doc%2Fstandards.texi;h=38d2c21f645e998d64cfd1efdcdc2f4125408622;hb=b65bfcd7ba0be84de3d96f22103103f21679a721;hp=1847370ccc7e25b815848225eb726da41a615b7f;hpb=ff2f086830480dfa85d1e98c46f8566feb657deb;p=gnulib.git diff --git a/doc/standards.texi b/doc/standards.texi index 1847370cc..38d2c21f6 100644 --- a/doc/standards.texi +++ b/doc/standards.texi @@ -3,7 +3,7 @@ @setfilename standards.info @settitle GNU Coding Standards @c This date is automagically updated when you save this file: -@set lastupdate March 28, 2011 +@set lastupdate August 1, 2011 @c %**end of header @dircategory GNU organization @@ -181,6 +181,7 @@ 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. + @node Contributions @section Accepting Contributions @cindex legal papers @@ -223,10 +224,11 @@ 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. -We have more detailed advice for maintainers of programs; if you have -reached the stage of actually maintaining a program for GNU (whether -released or not), please ask us for a copy. It is also available -online for your perusal: @uref{http://www.gnu.org/prep/maintain/}. +We have more detailed advice for maintainers of GNU packages. If you +have reached the stage of maintaining a GNU program (whether released +or not), please take a look: @pxref{Legal Matters,,, maintain, +Information for GNU Maintainers}. + @node Trademarks @section Trademarks @@ -594,6 +596,7 @@ POSIX is never a problem in practice, and it is very useful. In particular, don't reject a new feature, or remove an old one, merely because a standard says it is ``forbidden'' or ``deprecated.'' + @node Semantics @section Writing Robust Programs @@ -604,6 +607,7 @@ all data structures dynamically. In most Unix utilities, ``long lines are silently truncated''. This is not acceptable in a GNU utility. @cindex @code{NUL} characters +@findex libiconv Utilities reading files should not drop NUL characters, or any other nonprinting characters @emph{including those with codes above 0177}. The only sensible exceptions would be utilities specifically intended @@ -614,12 +618,12 @@ sequences of bytes that represent multibyte characters, using encodings such as UTF-8 and others. @cindex error messages -Check every system call for an error return, unless you know you wish to -ignore errors. Include the system error text (from @code{perror} or -equivalent) in @emph{every} error message resulting from a failing -system call, as well as the name of the file if any and the name of the -utility. Just ``cannot open foo.c'' or ``stat failed'' is not -sufficient. +Check every system call for an error return, unless you know you wish +to ignore errors. Include the system error text (from @code{perror}, +@code{strerror}, or equivalent) in @emph{every} error message +resulting from a failing system call, as well as the name of the file +if any and the name of the utility. Just ``cannot open foo.c'' or +``stat failed'' is not sufficient. @cindex @code{malloc} return value @cindex memory allocation failure @@ -2329,10 +2333,11 @@ memory and give a fatal error if @code{malloc} returns zero. @pindex valgrind @cindex memory leak -Memory leak detectors such as @command{valgrind} can be useful, but +Memory analysis tools such as @command{valgrind} can be useful, but don't complicate a program merely to avoid their false alarms. For example, if memory is used until just before a process exits, don't -free it simply to silence a leak detector. +free it simply to silence such a tool. + @node File Usage @section File Usage @@ -4019,11 +4024,13 @@ copying conditions. The GNU GPL, if used, should be in a file called @file{COPYING}. If the GNU LGPL is used, it should be in a file called @file{COPYING.LESSER}. -Naturally, all the source files must be in the distribution. It is okay -to include non-source files in the distribution, provided they are -up-to-date and machine-independent, so that building the distribution -normally will never modify them. We commonly include non-source files -produced by Bison, @code{lex}, @TeX{}, and @code{makeinfo}; this helps avoid +Naturally, all the source files must be in the distribution. It is +okay to include non-source files in the distribution along with the +source files they are generated from, provided they are up-to-date +with the source they are made from, and machine-independent, so that +normal building of the distribution will never modify them. We +commonly include non-source files produced by Autoconf, Automake, +Bison, @code{lex}, @TeX{}, and @code{makeinfo}; this helps avoid unnecessary dependencies between our distributions, so that users can install whichever packages they want to install.