This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PATCH: codingconventions.html completion
- To: <gcc-patches at gcc dot gnu dot org>
- Subject: PATCH: codingconventions.html completion
- From: Gerald Pfeifer <pfeifer at dbai dot tuwien dot ac dot at>
- Date: Sat, 11 Nov 2000 10:06:40 +0100 (CET)
- cc: Mark Mitchell <mark at codesourcery dot com>
This completes our specific coding conventions. I suggested and promised
this to Mark before my holidays but got delayed by other stuff afterwards.
Installed.
Gerald
Index: codingconventions.html
===================================================================
RCS file: /cvs/gcc/wwwdocs/htdocs/codingconventions.html,v
retrieving revision 1.1
diff -u -3 -p -r1.1 codingconventions.html
--- codingconventions.html 2000/11/02 10:15:05 1.1
+++ codingconventions.html 2000/11/11 09:01:20
@@ -82,11 +82,26 @@ Such conditions should not be generated
checks are expensive or the compiler can reasonably carry on after the
error, they may be conditioned on <code>--enable-checking</code>.</p>
-<p>Code in GCC should use <code>!x</code> rather than <code>!
-x</code>, and similarly for other unary operators; see <a
-href="http://gcc.gnu.org/ml/gcc/2000-09/msg00524.html">message</a>.
-However, <a href="http://gcc.gnu.org/ml/gcc/2000-09/msg00586.html">a
-space should be used with casts</a>.</p>
+<p>Code in GCC should use the following formatting conventions:</p>
+
+<table cellpadding="4">
+<tr>
+ <th align="right">Use...</th><th align="left">...instead of</th>
+</tr><tr>
+ <td align="right"><code>!x</code></td><td><code>! x</code></td>
+</tr><tr>
+ <td align="right"><code>~x</code></td><td><code>~ x</code></td>
+</tr><tr>
+ <td align="right"><code>-x</code> (unary minus)</td><td><code>- x</code></td>
+</tr><tr>
+ <td align="right"><code>(foo) x</code> (cast)</td>
+ <td><code>(foo)x</code></td>
+</tr><tr>
+ <td align="right"><code>*x</code> (pointer dereference)</td>
+ <td><code>* x</code></td>
+</tr>
+</table>
+
<p>Macros names should be in <code>ALL_CAPS</code> when it's important
to be aware that it's a macro (e.g. accessors and simple predicates),