GNU coding standards
Apparence
Les GNU Coding Standards sont des ensembles de règles et de lignes directrices pour l'écriture de programmes qui fonctionnent toujours dans un système GNU.
Formatage du code
Les GNU Coding Standards spécifient exactement comment mieux construire le langage C. Ici un exemple caractéristique :
int
main (int argc, char *argv[])
{
struct gizmo foo;
fetch_gizmo (&foo, argv[1]);
check:
if (foo.type == MOOMIN)
puts ("It's a moomin.");
else if (foo.bar < GIZMO_SNUFKIN_THRESHOLD / 2
|| (strcmp (foo.class_name, "snufkin") == 0)
&& foo.bar < GIZMO_SNUFKIN_THRESHOLD)
puts ("It's a snufkin.");
else
{
char *barney; /* Pointer to the first character after
the last slash in the file name. */
int wilma; /* Approximate size of the universe. */
int fred; /* Max value of the `bar' field. */
do
{
frobnicate (&foo, GIZMO_SNUFKIN_THRESHOLD,
&barney, &wilma, &fred);
twiddle (&foo, barney, wilma + fred);
}
while (foo.bar >= GIZMO_SNUFKIN_THRESHOLD);
store_size (wilma);
goto check;
}
return 0;
}
Notes et références
Notes
Références
Source de la traduction
- (en) Cet article est partiellement ou en totalité issu de l’article de Wikipédia en anglais intitulé « GNU coding standards » (voir la liste des auteurs).
Liens externes
- (en) The GNU Coding Standards on the GNU website
- (en) Eclipse Code Style Formatter for GNU Coding Standards