public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re:  Coding convention: use of `!x' vs. `! x'
@ 2000-09-22  9:32 Richard Kenner
  2000-09-22  9:41 ` GNU long long Matt Minnis
                   ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Richard Kenner @ 2000-09-22  9:32 UTC (permalink / raw)
  To: mark; +Cc: gcc

    However, I suggest that within GCC we use a consistent style going
    forward, and that the style be `!x' rather than `! x'.  This is no big
    deal, and it would be a waste of effort to change all uses of the
    latter into the former, but going forward let's use the former style.

What about the other unary operators?  Should they have a blank, like the
binary operators do, or no blank, like "!" now will?

^ permalink raw reply	[flat|nested] 18+ messages in thread
* Re: Coding convention: use of `!x' vs. `! x'
@ 2000-09-26  4:36 Jamie Lokier
  0 siblings, 0 replies; 18+ messages in thread
From: Jamie Lokier @ 2000-09-26  4:36 UTC (permalink / raw)
  To: gcc

On the subject of `!x' vs. `! x', I'd like to point out that different
operators have always been treated differently.

Does anyone write `a -> b' or `a . b'?  I didn't think so.

Does anyone write `a = * b;'?  Sometimes, but not all that often.

Casts.  Most of GCC and indeed GNU code generally includes a space
between the cast and the value: `(unsigned int) x'.

Unary operators that aren't casts: `++x', `x++', `*x', `!x' etc. seem to
be the norm.  However, `* x' and `- x' do appear from time to time.

Function calls include space between the function name and arguments,
including when the function is a pointer expression like `a->b (args)'.
When the function name is surrounded by parantheses, a space is still
included just as with cases: `(*fn) (args)'.

Binary expression operators are generally surrounded by whitespace.
However, `a->b', `a.b' and for C++, `a::b' seem to be the norm for
syntactic operators.

Occasionally in non-GCC code I see space used to indicate grouping:
`a + 2*b' for example.  I think it looks equally clear with or without
the spaces there, and for consistency I tend to write `a + 2 * b'.

enjoy,
-- Jamie

^ permalink raw reply	[flat|nested] 18+ messages in thread
[parent not found: <969652582.12981.ezmlm@gcc.gnu.org>]
* Coding convention: use of `!x' vs. `! x'
@ 2000-09-22  0:29 Mark Mitchell
  2000-09-24 22:57 ` Geoff Keating
  0 siblings, 1 reply; 18+ messages in thread
From: Mark Mitchell @ 2000-09-22  0:29 UTC (permalink / raw)
  To: gcc; +Cc: Gerald Pfeifer

I have contacted the people responsible for the GNU Coding Standards,
and they have indicated that there is no official GNU practice, and
that the issue is sufficiently minor that they do not think an
offical GNU standard is required.

However, I suggest that within GCC we use a consistent style going
forward, and that the style be `!x' rather than `! x'.  This is no big
deal, and it would be a waste of effort to change all uses of the
latter into the former, but going forward let's use the former style.

Gerald, as web page maintainer would you be willing to create a page
for coding standards used in GCC above and beyond those mandated by
the GNU Coding Standards?  The discussion we just had about using
all_lowercase names for macros that are front-ends for functions would
be another thing we could include on this page.  I'm sure more things
will come up in the future.

Thanks,

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2000-09-30  9:52 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-09-22  9:32 Coding convention: use of `!x' vs. `! x' Richard Kenner
2000-09-22  9:41 ` GNU long long Matt Minnis
2000-09-22 13:33   ` Joseph S. Myers
2000-09-22  9:50 ` Coding convention: use of `!x' vs. `! x' David Edelsohn
2000-09-22 10:22   ` Gabriel Dos Reis
2000-09-22 10:22   ` Tim Hollebeek
2000-09-30  9:52 ` Mark Mitchell
  -- strict thread matches above, loose matches on Subject: below --
2000-09-26  4:36 Jamie Lokier
     [not found] <969652582.12981.ezmlm@gcc.gnu.org>
2000-09-22 17:00 ` Tim Josling
2000-09-22 18:21   ` Stan Shebs
2000-09-22 21:44   ` Mark Mitchell
2000-09-25  2:04     ` Akim Demaille
2000-09-25  7:29       ` Mark Mitchell
2000-09-25 11:32       ` Phil Edwards
2000-09-26  1:29         ` Andreas Schwab
2000-09-22  0:29 Mark Mitchell
2000-09-24 22:57 ` Geoff Keating
2000-09-24 23:43   ` Mark Mitchell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).