Holas
Richard Stallman, et al.
last updated September 25, 2011
The GNU coding standards, last updated September 25, 2011.
Copyright c 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document under the terms ofthe GNU Free Documentation License, Version 1.3 or any later version published by the
Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with
no Back-Cover Texts. A copy of the license is included in the section entitled “GNU Free
Documentation License”.
i
Table of Contents
1
About the GNU Coding Standards . . . . . . . . . . . 1
2
KeepingFree Software Free . . . . . . . . . . . . . . . . . . . . 1
2.1
2.2
2.3
3
General Program Design . . . . . . . . . . . . . . . . . . . . . . . 3
3.1
3.2
3.3
3.4
3.5
4
Referring to Proprietary Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Accepting Contributions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Trademarks. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Which Languages to Use . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Compatibility with Other Implementations . . . . . . . . . . . . . . . . . . . . .
Using Non-standard Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Standard C and Pre-Standard C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Conditional Compilation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3
4
4
5
6
Program Behavior for All Programs . . . . . . . . . . 6
4.1
4.2
4.3
4.4
4.5
4.6
4.7
Non-GNU Standards . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . 7
Writing Robust Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Library Behavior . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Formatting Error Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Standards for Interfaces Generally . . . . . . . . . . . . . . . . .. . . . . . . . . . . . 10
Standards for Graphical Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Standards for Command Line Interfaces . . . . . . . . . . . . . . . . . . . . . . . 11
4.7.1 ‘--version’ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
4.7.2 ‘--help’ . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . 13
4.8 Standards for Dynamic Plug-in Interfaces . . . . . . . . . . . . . . . . . . . . . . 13
4.9 Table of Long Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
4.10 OID Allocations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
4.11 Memory Usage . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
4.12 File Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
5
Making The Best Use of C . . . . . . . . . . . . . . . . . . . 31
5.1
5.2
5.3
5.4
5.5
5.6
5.7
5.8
5.9
5.10
5.11
Formatting Your Source Code . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . .
Commenting Your Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Clean Use of C Constructs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Naming Variables, Functions, and Files . . . . . . . . . . . . . . . . . . . . . . . .
Portability between System Types . . . . . . . . . . . . . . . . . . . . . . . . . ....
Regístrate para leer el documento completo.