home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 9 / FreshFishVol9-CD2.bin / bbs / gnu / autoconf-2.1-src.lha / autoconf-2.1 / standards.info-1 < prev    next >
Encoding:
GNU Info File  |  1994-09-25  |  48.3 KB  |  1,189 lines

  1. This is Info file ../standards.info, produced by Makeinfo-1.55 from the
  2. input file ../standards.texi.
  3.  
  4. START-INFO-DIR-ENTRY
  5. * Standards: (standards).        GNU coding standards.
  6. END-INFO-DIR-ENTRY
  7.  
  8.    GNU Coding Standards Copyright (C) 1992, 1993, 1994 Free Software
  9. Foundation, Inc.
  10.  
  11.    Permission is granted to make and distribute verbatim copies of this
  12. manual provided the copyright notice and this permission notice are
  13. preserved on all copies.
  14.  
  15.    Permission is granted to copy and distribute modified versions of
  16. this manual under the conditions for verbatim copying, provided that
  17. the entire resulting derived work is distributed under the terms of a
  18. permission notice identical to this one.
  19.  
  20.    Permission is granted to copy and distribute translations of this
  21. manual into another language, under the above conditions for modified
  22. versions, except that this permission notice may be stated in a
  23. translation approved by the Free Software Foundation.
  24.  
  25. 
  26. File: standards.info,  Node: Top,  Next: Preface,  Prev: (dir),  Up: (dir)
  27.  
  28. Version
  29. *******
  30.  
  31.    Last updated 21 September 1994.
  32.  
  33. * Menu:
  34.  
  35. * Preface::            About the GNU Coding Standards
  36. * Reading Non-Free Code::    Referring to Proprietary Programs
  37. * Contributions::        Accepting Contributions
  38. * Change Logs::            Recording Changes
  39. * Compatibility::        Compatibility with Other Implementations
  40. * Makefile Conventions::    Makefile Conventions
  41. * Configuration::        How Configuration Should Work
  42. * Source Language::        Using Languages Other Than C
  43. * Formatting::            Formatting Your Source Code
  44. * Comments::            Commenting Your Work
  45. * Syntactic Conventions::    Clean Use of C Constructs
  46. * Names::            Naming Variables and Functions
  47. * Using Extensions::        Using Non-standard Features
  48. * System Functions::            Portability and "standard" library functions
  49. * Semantics::            Program Behavior for All Programs
  50. * Errors::            Formatting Error Messages
  51. * Libraries::            Library Behavior
  52. * Portability::            Portability As It Applies to GNU
  53. * User Interfaces::        Standards for Command Line Interfaces
  54. * Documentation::        Documenting Programs
  55. * Releases::            Making Releases
  56.  
  57. 
  58. File: standards.info,  Node: Preface,  Next: Reading Non-Free Code,  Prev: Top,  Up: Top
  59.  
  60. About the GNU Coding Standards
  61. ******************************
  62.  
  63.    The GNU Coding Standards were written by Richard Stallman and other
  64. GNU Project volunteers.  Their purpose is to make the GNU system clean,
  65. consistent, and easy to install.  This document can also be read as a
  66. guide to write portable, robust and reliable programs.  It focuses on
  67. programs written in C, but many of the rules and principles are useful
  68. even if you write in another programming language.  The rules often
  69. state reasons for writing in a certain way.
  70.  
  71.    Corrections or suggestions regarding this document should be sent to
  72. `gnu@prep.ai.mit.edu'.  If you make a suggestion, please include a
  73. suggested new wording for it; our time is limited.  We prefer a context
  74. diff to the `standards.texi' or `make-stds.texi' files, but if you
  75. don't have those files, please mail your suggestion anyway.
  76.  
  77.    This release of the GNU Coding Standards was last updated 21
  78. September 1994.
  79.  
  80. 
  81. File: standards.info,  Node: Reading Non-Free Code,  Next: Contributions,  Prev: Preface,  Up: Top
  82.  
  83. Referring to Proprietary Programs
  84. *********************************
  85.  
  86.    Don't in any circumstances refer to Unix source code for or during
  87. your work on GNU!  (Or to any other proprietary programs.)
  88.  
  89.    If you have a vague recollection of the internals of a Unix program,
  90. this does not absolutely mean you can't write an imitation of it, but
  91. do try to organize the imitation internally along different lines,
  92. because this is likely to make the details of the Unix version
  93. irrelevant and dissimilar to your results.
  94.  
  95.    For example, Unix utilities were generally optimized to minimize
  96. memory use; if you go for speed instead, your program will be very
  97. different.  You could keep the entire input file in core and scan it
  98. there instead of using stdio.  Use a smarter algorithm discovered more
  99. recently than the Unix program.  Eliminate use of temporary files.  Do
  100. it in one pass instead of two (we did this in the assembler).
  101.  
  102.    Or, on the contrary, emphasize simplicity instead of speed.  For some
  103. applications, the speed of today's computers makes simpler algorithms
  104. adequate.
  105.  
  106.    Or go for generality.  For example, Unix programs often have static
  107. tables or fixed-size strings, which make for arbitrary limits; use
  108. dynamic allocation instead.  Make sure your program handles NULs and
  109. other funny characters in the input files.  Add a programming language
  110. for extensibility and write part of the program in that language.
  111.  
  112.    Or turn some parts of the program into independently usable
  113. libraries.  Or use a simple garbage collector instead of tracking
  114. precisely when to free memory, or use a new GNU facility such as
  115. obstacks.
  116.  
  117. 
  118. File: standards.info,  Node: Contributions,  Next: Change Logs,  Prev: Reading Non-Free Code,  Up: Top
  119.  
  120. Accepting Contributions
  121. ***********************
  122.  
  123.    If someone else sends you a piece of code to add to the program you
  124. are working on, we need legal papers to use it--the same sort of legal
  125. papers we will need to get from you.  *Each* significant contributor to
  126. a program must sign some sort of legal papers in order for us to have
  127. clear title to the program.  The main author alone is not enough.
  128.  
  129.    So, before adding in any contributions from other people, tell us so
  130. we can arrange to get the papers.  Then wait until we tell you that we
  131. have received the signed papers, before you actually use the
  132. contribution.
  133.  
  134.    This applies both before you release the program and afterward.  If
  135. you receive diffs to fix a bug, and they make significant change, we
  136. need legal papers for it.
  137.  
  138.    You don't need papers for changes of a few lines here or there, since
  139. they are not significant for copyright purposes.  Also, you don't need
  140. papers if all you get from the suggestion is some ideas, not actual code
  141. which you use.  For example, if you write a different solution to the
  142. problem, you don't need to get papers.
  143.  
  144.    I know this is frustrating; it's frustrating for us as well.  But if
  145. you don't wait, you are going out on a limb--for example, what if the
  146. contributor's employer won't sign a disclaimer?  You might have to take
  147. that code out again!
  148.  
  149.    The very worst thing is if you forget to tell us about the other
  150. contributor.  We could be very embarrassed in court some day as a
  151. result.
  152.  
  153. 
  154. File: standards.info,  Node: Change Logs,  Next: Compatibility,  Prev: Contributions,  Up: Top
  155.  
  156. Change Logs
  157. ***********
  158.  
  159.    Keep a change log for each directory, describing the changes made to
  160. source files in that directory.  The purpose of this is so that people
  161. investigating bugs in the future will know about the changes that might
  162. have introduced the bug.  Often a new bug can be found by looking at
  163. what was recently changed.  More importantly, change logs can help
  164. eliminate conceptual inconsistencies between different parts of a
  165. program; they can give you a history of how the conflicting concepts
  166. arose.
  167.  
  168.    Use the Emacs command `M-x add-change' to start a new entry in the
  169. change log.  An entry should have an asterisk, the name of the changed
  170. file, and then in parentheses the name of the changed functions,
  171. variables or whatever, followed by a colon.  Then describe the changes
  172. you made to that function or variable.
  173.  
  174.    Separate unrelated entries with blank lines.  When two entries
  175. represent parts of the same change, so that they work together, then
  176. don't put blank lines between them.  Then you can omit the file name
  177. and the asterisk when successive entries are in the same file.
  178.  
  179.    Here are some examples:
  180.  
  181.      * register.el (insert-register): Return nil.
  182.      (jump-to-register): Likewise.
  183.      
  184.      * sort.el (sort-subr): Return nil.
  185.      
  186.      * tex-mode.el (tex-bibtex-file, tex-file, tex-region):
  187.      Restart the tex shell if process is gone or stopped.
  188.      (tex-shell-running): New function.
  189.      
  190.      * expr.c (store_one_arg): Round size up for move_block_to_reg.
  191.      (expand_call): Round up when emitting USE insns.
  192.      * stmt.c (assign_parms): Round size up for move_block_from_reg.
  193.  
  194.    It's important to name the changed function or variable in full.
  195. Don't abbreviate them; don't combine them.  Subsequent maintainers will
  196. often search for a function name to find all the change log entries that
  197. pertain to it; if you abbreviate the name, they won't find it when they
  198. search.  For example, some people are tempted to abbreviate groups of
  199. function names by writing `* register.el ({insert,jump-to}-register)';
  200. this is not a good idea, since searching for `jump-to-register' or
  201. `insert-register' would not find the entry.
  202.  
  203.    There's no need to describe the full purpose of the changes or how
  204. they work together.  It is better to put such explanations in comments
  205. in the code.  That's why just "New function" is enough; there is a
  206. comment with the function in the source to explain what it does.
  207.  
  208.    However, sometimes it is useful to write one line to describe the
  209. overall purpose of a large batch of changes.
  210.  
  211.    You can think of the change log as a conceptual "undo list" which
  212. explains how earlier versions were different from the current version.
  213. People can see the current version; they don't need the change log to
  214. tell them what is in it.  What they want from a change log is a clear
  215. explanation of how the earlier version differed.
  216.  
  217.    When you change the calling sequence of a function in a simple
  218. fashion, and you change all the callers of the function, there is no
  219. need to make individual entries for all the callers.  Just write in the
  220. entry for the function being called, "All callers changed."
  221.  
  222.    When you change just comments or doc strings, it is enough to write
  223. an entry for the file, without mentioning the functions.  Write just,
  224. "Doc fix."  There's no need to keep a change log for documentation
  225. files.  This is because documentation is not susceptible to bugs that
  226. are hard to fix.  Documentation does not consist of parts that must
  227. interact in a precisely engineered fashion; to correct an error, you
  228. need not know the history of the erroneous passage.
  229.  
  230. 
  231. File: standards.info,  Node: Compatibility,  Next: Makefile Conventions,  Prev: Change Logs,  Up: Top
  232.  
  233. Compatibility with Other Implementations
  234. ****************************************
  235.  
  236.    With certain exceptions, utility programs and libraries for GNU
  237. should be upward compatible with those in Berkeley Unix, and upward
  238. compatible with ANSI C if ANSI C specifies their behavior, and upward
  239. compatible with POSIX if POSIX specifies their behavior.
  240.  
  241.    When these standards conflict, it is useful to offer compatibility
  242. modes for each of them.
  243.  
  244.    ANSI C and POSIX prohibit many kinds of extensions.  Feel free to
  245. make the extensions anyway, and include a `--ansi' or `--compatible'
  246. option to turn them off.  However, if the extension has a significant
  247. chance of breaking any real programs or scripts, then it is not really
  248. upward compatible.  Try to redesign its interface.
  249.  
  250.    Many GNU programs suppress extensions that conflict with POSIX if the
  251. environment variable `POSIXLY_CORRECT' is defined (even if it is
  252. defined with a null value).  Please make your program recognize this
  253. variable if appropriate.
  254.  
  255.    When a feature is used only by users (not by programs or command
  256. files), and it is done poorly in Unix, feel free to replace it
  257. completely with something totally different and better.  (For example,
  258. vi is replaced with Emacs.)  But it is nice to offer a compatible
  259. feature as well.  (There is a free vi clone, so we offer it.)
  260.  
  261.    Additional useful features not in Berkeley Unix are welcome.
  262. Additional programs with no counterpart in Unix may be useful, but our
  263. first priority is usually to duplicate what Unix already has.
  264.  
  265. 
  266. File: standards.info,  Node: Makefile Conventions,  Next: Configuration,  Prev: Compatibility,  Up: Top
  267.  
  268. Makefile Conventions
  269. ********************
  270.  
  271.    This chapter describes conventions for writing the Makefiles for GNU
  272. programs.
  273.  
  274. * Menu:
  275.  
  276. * Makefile Basics::
  277. * Utilities in Makefiles::
  278. * Standard Targets::
  279. * Command Variables::
  280. * Directory Variables::
  281.  
  282. 
  283. File: standards.info,  Node: Makefile Basics,  Next: Utilities in Makefiles,  Up: Makefile Conventions
  284.  
  285. General Conventions for Makefiles
  286. =================================
  287.  
  288.    Every Makefile should contain this line:
  289.  
  290.      SHELL = /bin/sh
  291.  
  292. to avoid trouble on systems where the `SHELL' variable might be
  293. inherited from the environment.  (This is never a problem with GNU
  294. `make'.)
  295.  
  296.    Different `make' programs have incompatible suffix lists and
  297. implicit rules, and this sometimes creates confusion or misbehavior.  So
  298. it is a good idea to set the suffix list explicitly using only the
  299. suffixes you need in the particular Makefile, like this:
  300.  
  301.      .SUFFIXES:
  302.      .SUFFIXES: .c .o
  303.  
  304. The first line clears out the suffix list, the second introduces all
  305. suffixes which may be subject to implicit rules in this Makefile.
  306.  
  307.    Don't assume that `.' is in the path for command execution.  When
  308. you need to run programs that are a part of your package during the
  309. make, please make sure that it uses `./' if the program is built as
  310. part of the make or `$(srcdir)/' if the file is an unchanging part of
  311. the source code.  Without one of these prefixes, the current search
  312. path is used.
  313.  
  314.    The distinction between `./' and `$(srcdir)/' is important when
  315. using the `--srcdir' option to `configure'.  A rule of the form:
  316.  
  317.      foo.1 : foo.man sedscript
  318.              sed -e sedscript foo.man > foo.1
  319.  
  320. will fail when the current directory is not the source directory,
  321. because `foo.man' and `sedscript' are not in the current directory.
  322.  
  323.    When using GNU `make', relying on `VPATH' to find the source file
  324. will work in the case where there is a single dependency file, since
  325. the `make' automatic variable `$<' will represent the source file
  326. wherever it is.  (Many versions of `make' set `$<' only in implicit
  327. rules.)  A makefile target like
  328.  
  329.      foo.o : bar.c
  330.              $(CC) -I. -I$(srcdir) $(CFLAGS) -c bar.c -o foo.o
  331.  
  332. should instead be written as
  333.  
  334.      foo.o : bar.c
  335.              $(CC) -I. -I$(srcdir) $(CFLAGS) -c $< -o $@
  336.  
  337. in order to allow `VPATH' to work correctly.  When the target has
  338. multiple dependencies, using an explicit `$(srcdir)' is the easiest way
  339. to make the rule work well.  For example, the target above for `foo.1'
  340. is best written as:
  341.  
  342.      foo.1 : foo.man sedscript
  343.              sed -e $(srcdir)/sedscript $(srcdir)/foo.man > $@
  344.  
  345. 
  346. File: standards.info,  Node: Utilities in Makefiles,  Next: Standard Targets,  Prev: Makefile Basics,  Up: Makefile Conventions
  347.  
  348. Utilities in Makefiles
  349. ======================
  350.  
  351.    Write the Makefile commands (and any shell scripts, such as
  352. `configure') to run in `sh', not in `csh'.  Don't use any special
  353. features of `ksh' or `bash'.
  354.  
  355.    The `configure' script and the Makefile rules for building and
  356. installation should not use any utilities directly except these:
  357.  
  358.      cat cmp cp echo egrep expr grep
  359.      ln mkdir mv pwd rm rmdir sed test touch
  360.  
  361.    Stick to the generally supported options for these programs.  For
  362. example, don't use `mkdir -p', convenient as it may be, because most
  363. systems don't support it.
  364.  
  365.    The Makefile rules for building and installation can also use
  366. compilers and related programs, but should do so via `make' variables
  367. so that the user can substitute alternatives.  Here are some of the
  368. programs we mean:
  369.  
  370.      ar bison cc flex install ld lex
  371.      make makeinfo ranlib texi2dvi yacc
  372.  
  373.    Use the following `make' variables:
  374.  
  375.      $(AR) $(BISON) $(CC) $(FLEX) $(INSTALL) $(LD) $(LEX)
  376.      $(MAKE) $(MAKEINFO) $(RANLIB) $(TEXI2DVI) $(YACC)
  377.  
  378.    When you use `ranlib', you should make sure nothing bad happens if
  379. the system does not have `ranlib'.  Arrange to ignore an error from
  380. that command, and print a message before the command to tell the user
  381. that failure of the `ranlib' command does not mean a problem.
  382.  
  383.    If you use symbolic links, you should implement a fallback for
  384. systems that don't have symbolic links.
  385.  
  386.    It is ok to use other utilities in Makefile portions (or scripts)
  387. intended only for particular systems where you know those utilities to
  388. exist.
  389.  
  390. 
  391. File: standards.info,  Node: Standard Targets,  Next: Command Variables,  Prev: Utilities in Makefiles,  Up: Makefile Conventions
  392.  
  393. Standard Targets for Users
  394. ==========================
  395.  
  396.    All GNU programs should have the following targets in their
  397. Makefiles:
  398.  
  399. `all'
  400.      Compile the entire program.  This should be the default target.
  401.      This target need not rebuild any documentation files; Info files
  402.      should normally be included in the distribution, and DVI files
  403.      should be made only when explicitly asked for.
  404.  
  405. `install'
  406.      Compile the program and copy the executables, libraries, and so on
  407.      to the file names where they should reside for actual use.  If
  408.      there is a simple test to verify that a program is properly
  409.      installed, this target should run that test.
  410.  
  411.      The commands should create all the directories in which files are
  412.      to be installed, if they don't already exist.  This includes the
  413.      directories specified as the values of the variables `prefix' and
  414.      `exec_prefix', as well as all subdirectories that are needed.  One
  415.      way to do this is by means of an `installdirs' target as described
  416.      below.
  417.  
  418.      Use `-' before any command for installing a man page, so that
  419.      `make' will ignore any errors.  This is in case there are systems
  420.      that don't have the Unix man page documentation system installed.
  421.  
  422.      The way to install Info files is to copy them into `$(infodir)'
  423.      with `$(INSTALL_DATA)' (*note Command Variables::.), and then run
  424.      the `install-info' program if it is present.  `install-info' is a
  425.      script that edits the Info `dir' file to add or update the menu
  426.      entry for the given Info file; it will be part of the Texinfo
  427.      package.  Here is a sample rule to install an Info file:
  428.  
  429.           $(infodir)/foo.info: foo.info
  430.           # There may be a newer info file in . than in srcdir.
  431.                   -if test -f foo.info; then d=.; \
  432.                    else d=$(srcdir); fi; \
  433.                   $(INSTALL_DATA) $$d/foo.info $@; \
  434.           # Run install-info only if it exists.
  435.           # Use `if' instead of just prepending `-' to the
  436.           # line so we notice real errors from install-info.
  437.           # We use `$(SHELL) -c' because some shells do not
  438.           # fail gracefully when there is an unknown command.
  439.                   if $(SHELL) -c 'install-info --version' \
  440.                      >/dev/null 2>&1; then \
  441.                     install-info --infodir=$(infodir) $$d/foo.info; \
  442.                   else true; fi
  443.  
  444. `uninstall'
  445.      Delete all the installed files that the `install' target would
  446.      create (but not the noninstalled files such as `make all' would
  447.      create).
  448.  
  449. `clean'
  450.      Delete all files from the current directory that are normally
  451.      created by building the program.  Don't delete the files that
  452.      record the configuration.  Also preserve files that could be made
  453.      by building, but normally aren't because the distribution comes
  454.      with them.
  455.  
  456.      Delete `.dvi' files here if they are not part of the distribution.
  457.  
  458. `distclean'
  459.      Delete all files from the current directory that are created by
  460.      configuring or building the program.  If you have unpacked the
  461.      source and built the program without creating any other files,
  462.      `make distclean' should leave only the files that were in the
  463.      distribution.
  464.  
  465. `mostlyclean'
  466.      Like `clean', but may refrain from deleting a few files that people
  467.      normally don't want to recompile.  For example, the `mostlyclean'
  468.      target for GCC does not delete `libgcc.a', because recompiling it
  469.      is rarely necessary and takes a lot of time.
  470.  
  471. `realclean'
  472.      Delete everything from the current directory that can be
  473.      reconstructed with this Makefile.  This typically includes
  474.      everything deleted by `distclean', plus more: C source files
  475.      produced by Bison, tags tables, Info files, and so on.
  476.  
  477.      One exception, however: `make realclean' should not delete
  478.      `configure' even if `configure' can be remade using a rule in the
  479.      Makefile.  More generally, `make realclean' should not delete
  480.      anything that needs to exist in order to run `configure' and then
  481.      begin to build the program.
  482.  
  483. `TAGS'
  484.      Update a tags table for this program.
  485.  
  486. `info'
  487.      Generate any Info files needed.  The best way to write the rules
  488.      is as follows:
  489.  
  490.           info: foo.info
  491.           
  492.           foo.info: foo.texi chap1.texi chap2.texi
  493.                   $(MAKEINFO) $(srcdir)/foo.texi
  494.  
  495.      You must define the variable `MAKEINFO' in the Makefile.  It should
  496.      run the `makeinfo' program, which is part of the Texinfo
  497.      distribution.
  498.  
  499. `dvi'
  500.      Generate DVI files for all TeXinfo documentation.  For example:
  501.  
  502.           dvi: foo.dvi
  503.           
  504.           foo.dvi: foo.texi chap1.texi chap2.texi
  505.                   $(TEXI2DVI) $(srcdir)/foo.texi
  506.  
  507.      You must define the variable `TEXI2DVI' in the Makefile.  It should
  508.      run the program `texi2dvi', which is part of the Texinfo
  509.      distribution.  Alternatively, write just the dependencies, and
  510.      allow GNU Make to provide the command.
  511.  
  512. `dist'
  513.      Create a distribution tar file for this program.  The tar file
  514.      should be set up so that the file names in the tar file start with
  515.      a subdirectory name which is the name of the package it is a
  516.      distribution for.  This name can include the version number.
  517.  
  518.      For example, the distribution tar file of GCC version 1.40 unpacks
  519.      into a subdirectory named `gcc-1.40'.
  520.  
  521.      The easiest way to do this is to create a subdirectory
  522.      appropriately named, use `ln' or `cp' to install the proper files
  523.      in it, and then `tar' that subdirectory.
  524.  
  525.      The `dist' target should explicitly depend on all non-source files
  526.      that are in the distribution, to make sure they are up to date in
  527.      the distribution.  *Note Making Releases: (standards)Releases.
  528.  
  529. `check'
  530.      Perform self-tests (if any).  The user must build the program
  531.      before running the tests, but need not install the program; you
  532.      should write the self-tests so that they work when the program is
  533.      built but not installed.
  534.  
  535.    The following targets are suggested as conventional names, for
  536. programs in which they are useful.
  537.  
  538. `installcheck'
  539.      Perform installation tests (if any).  The user must build and
  540.      install the program before running the tests.  You should not
  541.      assume that `$(bindir)' is in the search path.
  542.  
  543. `installdirs'
  544.      It's useful to add a target named `installdirs' to create the
  545.      directories where files are installed, and their parent
  546.      directories.  There is a script called `mkinstalldirs' which is
  547.      convenient for this; find it in the Texinfo package.You can use a
  548.      rule like this:
  549.  
  550.           # Make sure all installation directories (e.g. $(bindir))
  551.           # actually exist by making them if necessary.
  552.           installdirs: mkinstalldirs
  553.                   $(srcdir)/mkinstalldirs $(bindir) $(datadir) \
  554.                                           $(libdir) $(infodir) \
  555.                                           $(mandir)
  556.  
  557. 
  558. File: standards.info,  Node: Command Variables,  Next: Directory Variables,  Prev: Standard Targets,  Up: Makefile Conventions
  559.  
  560. Variables for Specifying Commands
  561. =================================
  562.  
  563.    Makefiles should provide variables for overriding certain commands,
  564. options, and so on.
  565.  
  566.    In particular, you should run most utility programs via variables.
  567. Thus, if you use Bison, have a variable named `BISON' whose default
  568. value is set with `BISON = bison', and refer to it with `$(BISON)'
  569. whenever you need to use Bison.
  570.  
  571.    File management utilities such as `ln', `rm', `mv', and so on, need
  572. not be referred to through variables in this way, since users don't
  573. need to replace them with other programs.
  574.  
  575.    Each program-name variable should come with an options variable that
  576. is used to supply options to the program.  Append `FLAGS' to the
  577. program-name variable name to get the options variable name--for
  578. example, `BISONFLAGS'.  (The name `CFLAGS' is an exception to this
  579. rule, but we keep it because it is standard.)  Use `CPPFLAGS' in any
  580. compilation command that runs the preprocessor, and use `LDFLAGS' in
  581. any compilation command that does linking as well as in any direct use
  582. of `ld'.
  583.  
  584.    If there are C compiler options that *must* be used for proper
  585. compilation of certain files, do not include them in `CFLAGS'.  Users
  586. expect to be able to specify `CFLAGS' freely themselves.  Instead,
  587. arrange to pass the necessary options to the C compiler independently
  588. of `CFLAGS', by writing them explicitly in the compilation commands or
  589. by defining an implicit rule, like this:
  590.  
  591.      CFLAGS = -g
  592.      ALL_CFLAGS = -I. $(CFLAGS)
  593.      .c.o:
  594.              $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $<
  595.  
  596.    Do include the `-g' option in `CFLAGS', because that is not
  597. *required* for proper compilation.  You can consider it a default that
  598. is only recommended.  If the package is set up so that it is compiled
  599. with GCC by default, then you might as well include `-O' in the default
  600. value of `CFLAGS' as well.
  601.  
  602.    Put `CFLAGS' last in the compilation command, after other variables
  603. containing compiler options, so the user can use `CFLAGS' to override
  604. the others.
  605.  
  606.    Every Makefile should define the variable `INSTALL', which is the
  607. basic command for installing a file into the system.
  608.  
  609.    Every Makefile should also define the variables `INSTALL_PROGRAM'
  610. and `INSTALL_DATA'.  (The default for each of these should be
  611. `$(INSTALL)'.)  Then it should use those variables as the commands for
  612. actual installation, for executables and nonexecutables respectively.
  613. Use these variables as follows:
  614.  
  615.      $(INSTALL_PROGRAM) foo $(bindir)/foo
  616.      $(INSTALL_DATA) libfoo.a $(libdir)/libfoo.a
  617.  
  618. Always use a file name, not a directory name, as the second argument of
  619. the installation commands.  Use a separate command for each file to be
  620. installed.
  621.  
  622. 
  623. File: standards.info,  Node: Directory Variables,  Prev: Command Variables,  Up: Makefile Conventions
  624.  
  625. Variables for Installation Directories
  626. ======================================
  627.  
  628.    Installation directories should always be named by variables, so it
  629. is easy to install in a nonstandard place.  The standard names for these
  630. variables are as follows.
  631.  
  632.    These two variables set the root for the installation.  All the other
  633. installation directories should be subdirectories of one of these two,
  634. and nothing should be directly installed into these two directories.
  635.  
  636. `prefix'
  637.      A prefix used in constructing the default values of the variables
  638.      listed below.  The default value of `prefix' should be `/usr/local'
  639.      (at least for now).
  640.  
  641. `exec_prefix'
  642.      A prefix used in constructing the default values of some of the
  643.      variables listed below.  The default value of `exec_prefix' should
  644.      be `$(prefix)'.
  645.  
  646.      Generally, `$(exec_prefix)' is used for directories that contain
  647.      machine-specific files (such as executables and subroutine
  648.      libraries), while `$(prefix)' is used directly for other
  649.      directories.
  650.  
  651.    Executable programs are installed in one of the following
  652. directories.
  653.  
  654. `bindir'
  655.      The directory for installing executable programs that users can
  656.      run.  This should normally be `/usr/local/bin', but write it as
  657.      `$(exec_prefix)/bin'.
  658.  
  659. `sbindir'
  660.      The directory for installing executable programs that can be run
  661.      from the shell, but are only generally useful to system
  662.      administrators.  This should normally be `/usr/local/sbin', but
  663.      write it as `$(exec_prefix)/sbin'.
  664.  
  665. `libexecdir'
  666.      The directory for installing executable programs to be run by other
  667.      programs rather than by users.  This directory should normally be
  668.      `/usr/local/libexec', but write it as `$(exec_prefix)/libexec'.
  669.  
  670.    Data files used by the program during its execution are divided into
  671. categories in two ways.
  672.  
  673.    * Some files are normally modified by programs; others are never
  674.      normally modified (though users may edit some of these).
  675.  
  676.    * Some files are architecture-independent and can be shared by all
  677.      machines at a site; some are architecture-dependent and can be
  678.      shared only by machines of the same kind and operating system;
  679.      others may never be shared between two machines.
  680.  
  681.    This makes for six different possibilities.  However, we want to
  682. discourage the use of architecture-dependent files, aside from of object
  683. files and libraries.  It is much cleaner to make other data files
  684. architecture-independent, and it is generally not hard.
  685.  
  686.    Therefore, here are the variables makefiles should use to specify
  687. directories:
  688.  
  689. `datadir'
  690.      The directory for installing read-only architecture independent
  691.      data files.  This should normally be `/usr/local/share', but write
  692.      it as `$(prefix)/share'.  As a special exception, see `$(infodir)'
  693.      and `$(includedir)' below.
  694.  
  695. `sysconfdir'
  696.      The directory for installing read-only data files that pertain to a
  697.      single machine-that is to say, files for configuring a host.
  698.      Mailer and network configuration files, `/etc/passwd', and so
  699.      forth belong here.  All the files in this directory should be
  700.      ordinary ASCII text files.  This directory should normally be
  701.      `/usr/local/etc', but write it as `$(prefix)/etc'.
  702.  
  703.      Do not install executables in this directory (they probably belong
  704.      in `$(libexecdir)' or `$(sbindir))'.  Also do not install files
  705.      that are modified in the normal course of their use (programs
  706.      whose purpose is to change the configuration of the system
  707.      excluded).  Those probably belong in `$(localstatedir)'.
  708.  
  709. `sharedstatedir'
  710.      The directory for installing architecture-independent data files
  711.      which the programs modify while they run.  This should normally be
  712.      `/usr/local/com', but write it as `$(prefix)/com'.
  713.  
  714. `localstatedir'
  715.      The directory for installing data files which the programs modify
  716.      while they run, and that pertain to one specific machine.  Users
  717.      should never need to modify files in this directory to configure
  718.      the package's operation; put such configuration information in
  719.      separate files that go in `datadir' or `$(sysconfdir)'.
  720.      `$(localstatedir)' should normally be `/usr/local/var', but write
  721.      it as `$(prefix)/var'.
  722.  
  723. `libdir'
  724.      The directory for object files and libraries of object code.  Do
  725.      not install executables here, they probably belong in
  726.      `$(libexecdir)' instead.  The value of `libdir' should normally be
  727.      `/usr/local/lib', but write it as `$(exec_prefix)/lib'.
  728.  
  729. `infodir'
  730.      The directory for installing the Info files for this package.  By
  731.      default, it should be `/usr/local/info', but it should be written
  732.      as `$(prefix)/info'.
  733.  
  734. `includedir'
  735.      The directory for installing header files to be included by user
  736.      programs with the C `#include' preprocessor directive.  This
  737.      should normally be `/usr/local/include', but write it as
  738.      `$(prefix)/include'.
  739.  
  740.      Most compilers other than GCC do not look for header files in
  741.      `/usr/local/include'.  So installing the header files this way is
  742.      only useful with GCC.  Sometimes this is not a problem because some
  743.      libraries are only really intended to work with GCC.  But some
  744.      libraries are intended to work with other compilers.  They should
  745.      install their header files in two places, one specified by
  746.      `includedir' and one specified by `oldincludedir'.
  747.  
  748. `oldincludedir'
  749.      The directory for installing `#include' header files for use with
  750.      compilers other than GCC.  This should normally be `/usr/include'.
  751.  
  752.      The Makefile commands should check whether the value of
  753.      `oldincludedir' is empty.  If it is, they should not try to use
  754.      it; they should cancel the second installation of the header files.
  755.  
  756.      A package should not replace an existing header in this directory
  757.      unless the header came from the same package.  Thus, if your Foo
  758.      package provides a header file `foo.h', then it should install the
  759.      header file in the `oldincludedir' directory if either (1) there
  760.      is no `foo.h' there or (2) the `foo.h' that exists came from the
  761.      Foo package.
  762.  
  763.      To tell whether `foo.h' came from the Foo package, put a magic
  764.      string in the file--part of a comment--and grep for that string.
  765.  
  766.    Unix-style man pages are installed in one of the following:
  767.  
  768. `mandir'
  769.      The directory for installing the man pages (if any) for this
  770.      package.  It should include the suffix for the proper section of
  771.      the manual--usually `1' for a utility.  It will normally be
  772.      `/usr/local/man/man1', but you should write it as
  773.      `$(prefix)/man/man1'.
  774.  
  775. `man1dir'
  776.      The directory for installing section 1 man pages.
  777.  
  778. `man2dir'
  779.      The directory for installing section 2 man pages.
  780.  
  781. `...'
  782.      Use these names instead of `mandir' if the package needs to
  783.      install man pages in more than one section of the manual.
  784.  
  785.      *Don't make the primary documentation for any GNU software be a
  786.      man page.  Write a manual in Texinfo instead.  Man pages are just
  787.      for the sake of people running GNU software on Unix, which is a
  788.      secondary application only.*
  789.  
  790. `manext'
  791.      The file name extension for the installed man page.  This should
  792.      contain a period followed by the appropriate digit; it should
  793.      normally be `.1'.
  794.  
  795. `man1ext'
  796.      The file name extension for installed section 1 man pages.
  797.  
  798. `man2ext'
  799.      The file name extension for installed section 2 man pages.
  800.  
  801. `...'
  802.      Use these names instead of `manext' if the package needs to
  803.      install man pages in more than one section of the manual.
  804.  
  805.    And finally, you should set the following variable:
  806.  
  807. `srcdir'
  808.      The directory for the sources being compiled.  The value of this
  809.      variable is normally inserted by the `configure' shell script.
  810.  
  811.    For example:
  812.  
  813.      # Common prefix for installation directories.
  814.      # NOTE: This directory must exist when you start the install.
  815.      prefix = /usr/local
  816.      exec_prefix = $(prefix)
  817.      # Where to put the executable for the command `gcc'.
  818.      bindir = $(exec_prefix)/bin
  819.      # Where to put the directories used by the compiler.
  820.      libexecdir = $(exec_prefix)/libexec
  821.      # Where to put the Info files.
  822.      infodir = $(prefix)/info
  823.  
  824.    If your program installs a large number of files into one of the
  825. standard user-specified directories, it might be useful to group them
  826. into a subdirectory particular to that program.  If you do this, you
  827. should write the `install' rule to create these subdirectories.
  828.  
  829.    Do not expect the user to include the subdirectory name in the value
  830. of any of the variables listed above.  The idea of having a uniform set
  831. of variable names for installation directories is to enable the user to
  832. specify the exact same values for several different GNU packages.  In
  833. order for this to be useful, all the packages must be designed so that
  834. they will work sensibly when the user does so.
  835.  
  836. 
  837. File: standards.info,  Node: Configuration,  Next: Source Language,  Prev: Makefile Conventions,  Up: Top
  838.  
  839. How Configuration Should Work
  840. *****************************
  841.  
  842.    Each GNU distribution should come with a shell script named
  843. `configure'.  This script is given arguments which describe the kind of
  844. machine and system you want to compile the program for.
  845.  
  846.    The `configure' script must record the configuration options so that
  847. they affect compilation.
  848.  
  849.    One way to do this is to make a link from a standard name such as
  850. `config.h' to the proper configuration file for the chosen system.  If
  851. you use this technique, the distribution should *not* contain a file
  852. named `config.h'.  This is so that people won't be able to build the
  853. program without configuring it first.
  854.  
  855.    Another thing that `configure' can do is to edit the Makefile.  If
  856. you do this, the distribution should *not* contain a file named
  857. `Makefile'.  Instead, include a file `Makefile.in' which contains the
  858. input used for editing.  Once again, this is so that people won't be
  859. able to build the program without configuring it first.
  860.  
  861.    If `configure' does write the `Makefile', then `Makefile' should
  862. have a target named `Makefile' which causes `configure' to be rerun,
  863. setting up the same configuration that was set up last time.  The files
  864. that `configure' reads should be listed as dependencies of `Makefile'.
  865.  
  866.    All the files which are output from the `configure' script should
  867. have comments at the beginning explaining that they were generated
  868. automatically using `configure'.  This is so that users won't think of
  869. trying to edit them by hand.
  870.  
  871.    The `configure' script should write a file named `config.status'
  872. which describes which configuration options were specified when the
  873. program was last configured.  This file should be a shell script which,
  874. if run, will recreate the same configuration.
  875.  
  876.    The `configure' script should accept an option of the form
  877. `--srcdir=DIRNAME' to specify the directory where sources are found (if
  878. it is not the current directory).  This makes it possible to build the
  879. program in a separate directory, so that the actual source directory is
  880. not modified.
  881.  
  882.    If the user does not specify `--srcdir', then `configure' should
  883. check both `.' and `..' to see if it can find the sources.  If it finds
  884. the sources in one of these places, it should use them from there.
  885. Otherwise, it should report that it cannot find the sources, and should
  886. exit with nonzero status.
  887.  
  888.    Usually the easy way to support `--srcdir' is by editing a
  889. definition of `VPATH' into the Makefile.  Some rules may need to refer
  890. explicitly to the specified source directory.  To make this possible,
  891. `configure' can add to the Makefile a variable named `srcdir' whose
  892. value is precisely the specified directory.
  893.  
  894.    The `configure' script should also take an argument which specifies
  895. the type of system to build the program for.  This argument should look
  896. like this:
  897.  
  898.      CPU-COMPANY-SYSTEM
  899.  
  900.    For example, a Sun 3 might be `m68k-sun-sunos4.1'.
  901.  
  902.    The `configure' script needs to be able to decode all plausible
  903. alternatives for how to describe a machine.  Thus, `sun3-sunos4.1'
  904. would be a valid alias.  So would `sun3-bsd4.2', since SunOS is
  905. basically BSD and no other BSD system is used on a Sun.  For many
  906. programs, `vax-dec-ultrix' would be an alias for `vax-dec-bsd', simply
  907. because the differences between Ultrix and BSD are rarely noticeable,
  908. but a few programs might need to distinguish them.
  909.  
  910.    There is a shell script called `config.sub' that you can use as a
  911. subroutine to validate system types and canonicalize aliases.
  912.  
  913.    Other options are permitted to specify in more detail the software
  914. or hardware present on the machine, and include or exclude optional
  915. parts of the package:
  916.  
  917. `--enable-FEATURE[=PARAMETER]'
  918.      Configure the package to build and install an optional user-level
  919.      facility called FEATURE.  This allows users to choose which
  920.      optional features to include.  Giving an optional PARAMETER of
  921.      `no' should omit FEATURE, if it is built by default.
  922.  
  923.      No `--enable' option should *ever* cause one feature to replace
  924.      another.  No `--enable' option should ever substitute one useful
  925.      behavior for another useful behavior.  The only proper use for
  926.      `--enable' is for questions of whether to build part of the program
  927.      or exclude it.
  928.  
  929. `--with-PACKAGE'
  930.      The package PACKAGE will be installed, so configure this package
  931.      to work with PACKAGE.
  932.  
  933.      Possible values of PACKAGE include `x', `x-toolkit', `gnu-as' (or
  934.      `gas'), `gnu-ld', `gnu-libc', and `gdb'.
  935.  
  936.      Do not use a `--with' option to specify the file name to use to
  937.      find certain files.  That is outside the scope of what `--with'
  938.      options are for.
  939.  
  940. `--nfp'
  941.      The target machine has no floating point processor.
  942.  
  943. `--gas'
  944.      The target machine assembler is GAS, the GNU assembler.  This is
  945.      obsolete; users should use `--with-gnu-as' instead.
  946.  
  947. `--x'
  948.      The target machine has the X Window System installed.  This is
  949.      obsolete; users should use `--with-x' instead.
  950.  
  951.    All `configure' scripts should accept all of these "detail" options,
  952. whether or not they make any difference to the particular package at
  953. hand.  In particular, they should accept any option that starts with
  954. `--with-' or `--enable-'.  This is so users will be able to configure
  955. an entire GNU source tree at once with a single set of options.
  956.  
  957.    You will note that the categories `--with-' and `--enable-' are
  958. narrow: they *do not* provide a place for any sort of option you might
  959. think of.  That is deliberate.  We want to limit the possible
  960. configuration options in GNU software.  We do not want GNU programs to
  961. have idiosyncratic configuration options.
  962.  
  963.    Packages that perform part of compilation may support
  964. cross-compilation.  In such a case, the host and target machines for
  965. the program may be different.  The `configure' script should normally
  966. treat the specified type of system as both the host and the target,
  967. thus producing a program which works for the same type of machine that
  968. it runs on.
  969.  
  970.    The way to build a cross-compiler, cross-assembler, or what have
  971. you, is to specify the option `--host=HOSTTYPE' when running
  972. `configure'.  This specifies the host system without changing the type
  973. of target system.  The syntax for HOSTTYPE is the same as described
  974. above.
  975.  
  976.    Bootstrapping a cross-compiler requires compiling it on a machine
  977. other than the host it will run on.  Compilation packages accept a
  978. configuration option `--build=HOSTTYPE' for specifying the
  979. configuration on which you will compile them, in case that is different
  980. from the host.
  981.  
  982.    Programs for which cross-operation is not meaningful need not accept
  983. the `--host' option, because configuring an entire operating system for
  984. cross-operation is not a meaningful thing.
  985.  
  986.    Some programs have ways of configuring themselves automatically.  If
  987. your program is set up to do this, your `configure' script can simply
  988. ignore most of its arguments.
  989.  
  990. 
  991. File: standards.info,  Node: Source Language,  Next: Formatting,  Prev: Configuration,  Up: Top
  992.  
  993. Using Languages Other Than C
  994. ****************************
  995.  
  996.    Using a language other than C is like using a non-standard feature:
  997. it will cause trouble for users.  Even if GCC supports the other
  998. language, users may find it inconvenient to have to install the
  999. compiler for that other language in order to build your program.  So
  1000. please write in C.
  1001.  
  1002.    There are three exceptions for this rule:
  1003.  
  1004.    * It is okay to use a special language if the same program contains
  1005.      an interpreter for that language.
  1006.  
  1007.      Thus, it is not a problem that GNU Emacs contains code written in
  1008.      Emacs Lisp, because it comes with a Lisp interpreter.
  1009.  
  1010.    * It is okay to use another language in a tool specifically intended
  1011.      for use with that language.
  1012.  
  1013.      This is okay because the only people who want to build the tool
  1014.      will be those who have installed the other language anyway.
  1015.  
  1016.    * If an application is not of extremely widespread interest, then
  1017.      perhaps it's not important if the application is inconvenient to
  1018.      install.
  1019.  
  1020. 
  1021. File: standards.info,  Node: Formatting,  Next: Comments,  Prev: Source Language,  Up: Top
  1022.  
  1023. Formatting Your Source Code
  1024. ***************************
  1025.  
  1026.    It is important to put the open-brace that starts the body of a C
  1027. function in column zero, and avoid putting any other open-brace or
  1028. open-parenthesis or open-bracket in column zero.  Several tools look
  1029. for open-braces in column zero to find the beginnings of C functions.
  1030. These tools will not work on code not formatted that way.
  1031.  
  1032.    It is also important for function definitions to start the name of
  1033. the function in column zero.  This helps people to search for function
  1034. definitions, and may also help certain tools recognize them.  Thus, the
  1035. proper format is this:
  1036.  
  1037.      static char *
  1038.      concat (s1, s2)        /* Name starts in column zero here */
  1039.           char *s1, *s2;
  1040.      {                     /* Open brace in column zero here */
  1041.        ...
  1042.      }
  1043.  
  1044. or, if you want to use ANSI C, format the definition like this:
  1045.  
  1046.      static char *
  1047.      concat (char *s1, char *s2)
  1048.      {
  1049.        ...
  1050.      }
  1051.  
  1052.    In ANSI C, if the arguments don't fit nicely on one line, split it
  1053. like this:
  1054.  
  1055.      int
  1056.      lots_of_args (int an_integer, long a_long, short a_short,
  1057.                    double a_double, float a_float)
  1058.      ...
  1059.  
  1060.    For the body of the function, we prefer code formatted like this:
  1061.  
  1062.      if (x < foo (y, z))
  1063.        haha = bar[4] + 5;
  1064.      else
  1065.        {
  1066.          while (z)
  1067.            {
  1068.              haha += foo (z, z);
  1069.              z--;
  1070.            }
  1071.          return ++x + bar ();
  1072.        }
  1073.  
  1074.    We find it easier to read a program when it has spaces before the
  1075. open-parentheses and after the commas.  Especially after the commas.
  1076.  
  1077.    When you split an expression into multiple lines, split it before an
  1078. operator, not after one.  Here is the right way:
  1079.  
  1080.      if (foo_this_is_long && bar > win (x, y, z)
  1081.          && remaining_condition)
  1082.  
  1083.    Try to avoid having two operators of different precedence at the same
  1084. level of indentation.  For example, don't write this:
  1085.  
  1086.      mode = (inmode[j] == VOIDmode
  1087.              || GET_MODE_SIZE (outmode[j]) > GET_MODE_SIZE (inmode[j])
  1088.              ? outmode[j] : inmode[j]);
  1089.  
  1090.    Instead, use extra parentheses so that the indentation shows the
  1091. nesting:
  1092.  
  1093.      mode = ((inmode[j] == VOIDmode
  1094.               || (GET_MODE_SIZE (outmode[j]) > GET_MODE_SIZE (inmode[j])))
  1095.              ? outmode[j] : inmode[j]);
  1096.  
  1097.    Insert extra parentheses so that Emacs will indent the code properly.
  1098. For example, the following indentation looks nice if you do it by hand,
  1099. but Emacs would mess it up:
  1100.  
  1101.      v = rup->ru_utime.tv_sec*1000 + rup->ru_utime.tv_usec/1000
  1102.          + rup->ru_stime.tv_sec*1000 + rup->ru_stime.tv_usec/1000;
  1103.  
  1104.    But adding a set of parentheses solves the problem:
  1105.  
  1106.      v = (rup->ru_utime.tv_sec*1000 + rup->ru_utime.tv_usec/1000
  1107.           + rup->ru_stime.tv_sec*1000 + rup->ru_stime.tv_usec/1000);
  1108.  
  1109.    Format do-while statements like this:
  1110.  
  1111.      do
  1112.        {
  1113.          a = foo (a);
  1114.        }
  1115.      while (a > 0);
  1116.  
  1117.    Please use formfeed characters (control-L) to divide the program into
  1118. pages at logical places (but not within a function).  It does not matter
  1119. just how long the pages are, since they do not have to fit on a printed
  1120. page.  The formfeeds should appear alone on lines by themselves.
  1121.  
  1122. 
  1123. File: standards.info,  Node: Comments,  Next: Syntactic Conventions,  Prev: Formatting,  Up: Top
  1124.  
  1125. Commenting Your Work
  1126. ********************
  1127.  
  1128.    Every program should start with a comment saying briefly what it is
  1129. for.  Example: `fmt - filter for simple filling of text'.
  1130.  
  1131.    Please put a comment on each function saying what the function does,
  1132. what sorts of arguments it gets, and what the possible values of
  1133. arguments mean and are used for.  It is not necessary to duplicate in
  1134. words the meaning of the C argument declarations, if a C type is being
  1135. used in its customary fashion.  If there is anything nonstandard about
  1136. its use (such as an argument of type `char *' which is really the
  1137. address of the second character of a string, not the first), or any
  1138. possible values that would not work the way one would expect (such as,
  1139. that strings containing newlines are not guaranteed to work), be sure
  1140. to say so.
  1141.  
  1142.    Also explain the significance of the return value, if there is one.
  1143.  
  1144.    Please put two spaces after the end of a sentence in your comments,
  1145. so that the Emacs sentence commands will work.  Also, please write
  1146. complete sentences and capitalize the first word.  If a lower-case
  1147. identifer comes at the beginning of a sentence, don't capitalize it!
  1148. Changing the spelling makes it a different identifier.  If you don't
  1149. like starting a sentence with a lower case letter, write the sentence
  1150. differently (e.g., "The identifier lower-case is ...").
  1151.  
  1152.    The comment on a function is much clearer if you use the argument
  1153. names to speak about the argument values.  The variable name itself
  1154. should be lower case, but write it in upper case when you are speaking
  1155. about the value rather than the variable itself.  Thus, "the inode
  1156. number NODE_NUM" rather than "an inode".
  1157.  
  1158.    There is usually no purpose in restating the name of the function in
  1159. the comment before it, because the reader can see that for himself.
  1160. There might be an exception when the comment is so long that the
  1161. function itself would be off the bottom of the screen.
  1162.  
  1163.    There should be a comment on each static variable as well, like this:
  1164.  
  1165.      /* Nonzero means truncate lines in the display;
  1166.         zero means continue them.  */
  1167.      int truncate_lines;
  1168.  
  1169.    Every `#endif' should have a comment, except in the case of short
  1170. conditionals (just a few lines) that are not nested.  The comment should
  1171. state the condition of the conditional that is ending, *including its
  1172. sense*.  `#else' should have a comment describing the condition *and
  1173. sense* of the code that follows.  For example:
  1174.  
  1175.      #ifdef foo
  1176.        ...
  1177.      #else /* not foo */
  1178.        ...
  1179.      #endif /* not foo */
  1180.  
  1181. but, by contrast, write the comments this way for a `#ifndef':
  1182.  
  1183.      #ifndef foo
  1184.        ...
  1185.      #else /* foo */
  1186.        ...
  1187.      #endif /* foo */
  1188.  
  1189.