Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2005:
[Freeciv-Dev] (PR#12928) standardize typedef naming
Home

[Freeciv-Dev] (PR#12928) standardize typedef naming

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#12928) standardize typedef naming
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 28 Apr 2005 14:12:11 -0700
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12928 >

As pointed out before, we have inconsistent naming of typedefs.  For
instance there is Tech_Type_id but Terrain_type_id.

IMO the latter is better because the former is inconsistent.  However we
could capitalize every word of the typedef (thus it would be
Tech_Type_Id, Terrain_Type_Id).  Vasco and I discussed this and agreed
we didn't care.  This patch implements the
capitalize-only-the-first-character convention.

Attached is:

1.  A patch for CodingStyle to clarify naming of just about everything.

2.  A search-and-replace script to rename the Xxx_Type_id typedefs.
Call it from the freeciv directory to do some renaming.

Any objections?

-jason

Index: doc/CodingStyle
===================================================================
RCS file: /home/freeciv/CVS/freeciv/doc/CodingStyle,v
retrieving revision 1.12
diff -u -r1.12 CodingStyle
--- doc/CodingStyle     7 Apr 2005 00:49:45 -0000       1.12
+++ doc/CodingStyle     28 Apr 2005 21:06:44 -0000
@@ -165,6 +165,24 @@
     return 1;  /* BAD! */
 
 ================================
+ Naming
+================================
+
+- Functions, variables, structs, unions, and enums should have lower-case
+  names.  Use underscores (_) to separate "words" in a name.
+
+- Typedefs are a little different because they're hard to distinguish from
+  keywords.  The first character in a Typedef should be capitalized.
+
+- Enumerated values (in an enum) should be named in all-caps.
+
+- Macros:
+  * macros which behave like functions may be named like functions.
+  * Specialty iterator macros may also be named like functions.
+  * Other macros should be named in all-caps.
+  See the "macros" section in HACKING.
+
+================================
  Other stuff
 ================================
 
Index: doc/HACKING
===================================================================
RCS file: /home/freeciv/CVS/freeciv/doc/HACKING,v
retrieving revision 1.24
diff -u -r1.24 HACKING
--- doc/HACKING 7 Apr 2005 00:49:45 -0000       1.24
+++ doc/HACKING 28 Apr 2005 21:06:45 -0000
@@ -1020,6 +1020,8 @@
 
 Note that many existing macros do not follow these guidelines.
 
+See also "naming" in CodingStyle.
+
 
 ===========================================================================
 Style Guide

Attachment: sub.sh
Description: Bourne shell script


[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#12928) standardize typedef naming, Jason Short <=