public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* Coding style for parameterless functions
@ 2023-12-05 11:55 Aktemur, Tankut Baris
  2023-12-05 14:36 ` Tom Tromey
  0 siblings, 1 reply; 2+ messages in thread
From: Aktemur, Tankut Baris @ 2023-12-05 11:55 UTC (permalink / raw)
  To: gdb-patches

Hello,

I have a question regarding the coding style of parameterless
functions.  The internal document [1] gives an example where
they are written with the "void" keyword, like this:

  /* Declaration */
  static void foo (void);

  /* Definition */

  void
  foo (void)
  {
  }

I couldn't find the exact email, but I remember quite well that in a
discussion it was stated we should no longer use the void keyword
since we started coding in C++.

What's the current coding style that should be followed?

Also, the testsuite coding style document [2] explicitly states to write
"(void)".  But note that input programs in the testsuite are usually C
programs.

Regards
-Baris


[1]: https://sourceware.org/gdb/wiki/Internals%20GDB-C-Coding-Standards#Function_Definitions:_Function_Name_at_Column_Zero
[2]: https://sourceware.org/gdb/wiki/Internals%20GDB-Testsuite-Coding-Standards 


Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva  
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928


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

* Re: Coding style for parameterless functions
  2023-12-05 11:55 Coding style for parameterless functions Aktemur, Tankut Baris
@ 2023-12-05 14:36 ` Tom Tromey
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Tromey @ 2023-12-05 14:36 UTC (permalink / raw)
  To: Aktemur, Tankut Baris; +Cc: gdb-patches

>>>>> Aktemur, Tankut Baris <tankut.baris.aktemur@intel.com> writes:

>   /* Declaration */
>   static void foo (void);

> I couldn't find the exact email, but I remember quite well that in a
> discussion it was stated we should no longer use the void keyword
> since we started coding in C++.

> What's the current coding style that should be followed?

Use () in C++ code.  "(void)" is a C-ism.

> Also, the testsuite coding style document [2] explicitly states to write
> "(void)".  But note that input programs in the testsuite are usually C
> programs.

Yes, for C programs you have to do this.

thanks,
Tom

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

end of thread, other threads:[~2023-12-05 14:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-05 11:55 Coding style for parameterless functions Aktemur, Tankut Baris
2023-12-05 14:36 ` Tom Tromey

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).