* [doc/gdbint] Mention some formatting guidelines for casts and unary operators
@ 2011-02-01 16:28 Pedro Alves
2011-02-01 18:48 ` Michael Snyder
2011-02-01 18:50 ` Eli Zaretskii
0 siblings, 2 replies; 6+ messages in thread
From: Pedro Alves @ 2011-02-01 16:28 UTC (permalink / raw)
To: gdb-patches
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [doc/gdbint] Mention some formatting guidelines for casts and unary operators
2011-02-01 16:28 [doc/gdbint] Mention some formatting guidelines for casts and unary operators Pedro Alves
@ 2011-02-01 18:48 ` Michael Snyder
2011-02-01 18:50 ` Eli Zaretskii
1 sibling, 0 replies; 6+ messages in thread
From: Michael Snyder @ 2011-02-01 18:48 UTC (permalink / raw)
To: Pedro Alves; +Cc: gdb-patches
Pedro Alves wrote:
> 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?
Good by me.
Suggest also:
(type *) (cast) instead of (type*)
(type *name) (prototype) instead of (type* name)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [doc/gdbint] Mention some formatting guidelines for casts and unary operators
2011-02-01 16:28 [doc/gdbint] Mention some formatting guidelines for casts and unary operators Pedro Alves
2011-02-01 18:48 ` Michael Snyder
@ 2011-02-01 18:50 ` Eli Zaretskii
2011-02-04 17:01 ` Pedro Alves
1 sibling, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2011-02-01 18:50 UTC (permalink / raw)
To: Pedro Alves; +Cc: gdb-patches
> From: Pedro Alves <pedro@codesourcery.com>
> Date: Tue, 1 Feb 2011 16:28:32 +0000
>
> Okay?
Yes, but please use ``@minus{}'' instead of ``-'' to produce the minus
sign. ``-'' produces a dash character, which is typeset slightly
differently in the printed version of the manual.
Thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [doc/gdbint] Mention some formatting guidelines for casts and unary operators
2011-02-01 18:50 ` Eli Zaretskii
@ 2011-02-04 17:01 ` Pedro Alves
2011-02-04 18:29 ` Eli Zaretskii
0 siblings, 1 reply; 6+ messages in thread
From: Pedro Alves @ 2011-02-04 17:01 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: gdb-patches
On Friday 04 February 2011 18:50:40, Eli Zaretskii wrote:
> > From: Pedro Alves <pedro@codesourcery.com>
> > Date: Tue, 1 Feb 2011 16:28:32 +0000
> >
> > Okay?
>
> Yes, but please use ``@minus{}'' instead of ``-'' to produce the minus
> sign. ``-'' produces a dash character, which is typeset slightly
> differently in the printed version of the manual.
Hmm, I'm confused. You mean @minus within @code{}?
-item @code{-x}
-@tab @code{- x}
+@item @code{@minus{}x}
+@tab @code{@minus{} x}
From info "(Texinfo)minus":
"You should not use `@minus{}' inside `@code'
or `@example' because the width distinction is
not made in the fixed-width font they use."
But it does indeed typeset a bit differently on html
at least. Did I get that "@code{@minus{}x}" right?
Thanks,
--
Pedro Alves
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [doc/gdbint] Mention some formatting guidelines for casts and unary operators
2011-02-04 17:01 ` Pedro Alves
@ 2011-02-04 18:29 ` Eli Zaretskii
2011-02-04 19:12 ` Pedro Alves
0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2011-02-04 18:29 UTC (permalink / raw)
To: Pedro Alves; +Cc: gdb-patches
> From: Pedro Alves <pedro@codesourcery.com>
> Date: Fri, 4 Feb 2011 17:01:39 +0000
> Cc: gdb-patches@sourceware.org
>
> On Friday 04 February 2011 18:50:40, Eli Zaretskii wrote:
> > > From: Pedro Alves <pedro@codesourcery.com>
> > > Date: Tue, 1 Feb 2011 16:28:32 +0000
> > >
> > > Okay?
> >
> > Yes, but please use ``@minus{}'' instead of ``-'' to produce the minus
> > sign. ``-'' produces a dash character, which is typeset slightly
> > differently in the printed version of the manual.
>
> Hmm, I'm confused. You mean @minus within @code{}?
No, I meant @minus{}@code{x}. But if that doesn't look right in print
(or PDF), feel free to disregard and use your original text.
> But it does indeed typeset a bit differently on html
> at least. Did I get that "@code{@minus{}x}" right?
Yes.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [doc/gdbint] Mention some formatting guidelines for casts and unary operators
2011-02-04 18:29 ` Eli Zaretskii
@ 2011-02-04 19:12 ` Pedro Alves
0 siblings, 0 replies; 6+ messages in thread
From: Pedro Alves @ 2011-02-04 19:12 UTC (permalink / raw)
To: gdb-patches, Eli Zaretskii
On Friday 04 February 2011 18:29:10, Eli Zaretskii wrote:
> > From: Pedro Alves <pedro@codesourcery.com>
> > Date: Fri, 4 Feb 2011 17:01:39 +0000
> > Cc: gdb-patches@sourceware.org
> >
> > On Friday 04 February 2011 18:50:40, Eli Zaretskii wrote:
> > > > From: Pedro Alves <pedro@codesourcery.com>
> > > > Date: Tue, 1 Feb 2011 16:28:32 +0000
> > > >
> > > > Okay?
> > >
> > > Yes, but please use ``@minus{}'' instead of ``-'' to produce the minus
> > > sign. ``-'' produces a dash character, which is typeset slightly
> > > differently in the printed version of the manual.
> >
> > Hmm, I'm confused. You mean @minus within @code{}?
>
> No, I meant @minus{}@code{x}. But if that doesn't look right in print
> (or PDF), feel free to disregard and use your original text.
Thanks. I went with the original text. @minus{}@code{x}
didn't look right both in html or in pdf (the ones I tried),
because '-' uses a different font than the 'x' and the
other surrounding text that way.
--
Pedro Alves
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-02-04 19:12 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-01 16:28 [doc/gdbint] Mention some formatting guidelines for casts and unary operators Pedro Alves
2011-02-01 18:48 ` Michael Snyder
2011-02-01 18:50 ` Eli Zaretskii
2011-02-04 17:01 ` Pedro Alves
2011-02-04 18:29 ` Eli Zaretskii
2011-02-04 19:12 ` Pedro Alves
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox