This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[doc/gdbint] Mention some formatting guidelines for casts and unary operators
- From: Pedro Alves <pedro at codesourcery dot com>
- To: gdb-patches at sourceware dot org
- Date: Tue, 1 Feb 2011 16:28:32 +0000
- Subject: [doc/gdbint] Mention some formatting guidelines for casts and unary operators
This is a follow up to a discussion from last November
<http://sourceware.org/ml/gdb-patches/2010-11/msg00121.html>,
that sort of came up today again.
It imports and casts to stone these recommendations (from GCC):
Use... ...instead of
!x ! x
~x ~ x
-x (unary minus) - x
(foo) x (cast) (foo)x
*x (pointer dereference) * x
which we have been largely following already anyway.
Okay?
--
Pedro Alves
2011-02-01 Pedro Alves <pedro@codesourcery.com>
* gdbint.texinfo (Formatting): Mention some formatting guidelines
for casts and unary operators.
---
gdb/doc/gdbint.texinfo | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
Index: src/gdb/doc/gdbint.texinfo
===================================================================
--- src.orig/gdb/doc/gdbint.texinfo 2011-01-13 15:07:50.000000000 +0000
+++ src/gdb/doc/gdbint.texinfo 2011-02-01 16:08:47.184645005 +0000
@@ -5785,7 +5785,8 @@ compiler.
@cindex source code formatting
The standard GNU recommendations for formatting must be followed
-strictly.
+strictly. Any @value{GDBN}-specific deviation from GNU
+recomendations is described below.
A function declaration should not have its name in column zero. A
function definition should have its name in column zero.
@@ -5828,6 +5829,27 @@ void * foo;
void* foo;
@end smallexample
+In addition, whitespace around casts and unary operators should follow
+the following guidelines:
+
+@multitable @columnfractions .2 .2 .8
+@item Use... @tab ...instead of @tab
+
+@item @code{!x}
+@tab @code{! x}
+@item @code{~x}
+@tab @code{~ x}
+@item @code{-x}
+@tab @code{- x}
+@tab (unary minus)
+@item @code{(foo) x}
+@tab @code{(foo)x}
+@tab (cast)
+@item @code{*x}
+@tab @code{* x}
+@tab (pointer dereference)
+@end multitable
+
@subsection Comments
@cindex comment formatting