xboard-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [XBoard-devel] coding style


From: Tim Mann
Subject: Re: [XBoard-devel] coding style
Date: Mon, 2 Jan 2012 23:08:24 -0800

Odd, I never noticed that space after the function name in the GNU standard (or other GNU programs) before. Sure enough, though, there it is.

On Mon, Jan 2, 2012 at 5:07 PM, Arun Persaud <address@hidden> wrote:
Hi

On 12/23/2011 02:42 AM, Byrial Jensen wrote:
>[...]
> int MyFunc(char a, char b, int c)
> {
>   ...

fine with me... The GNU coding standards [1] use this format:

int
MyFunc (char a, char b, int c)

the newline is AFAIK, so that you (or automated tools) can search for
^MyFunc and they add a space after the function name. I would prefer if
we follow these standards, if that's ok with everyone.

> [...] Another "new" thing I had like to use, is the const qualifier. It can
> help finding bugs, and it allows for more aggresive optimisation.[...]

sounds good.

How about also using the following in the future for ifs and while loops

if (x < foo (y, z))
 haha = bar[4] + 5;
else
 {
   while (z)
     {
       haha += foo (z, z);
       z--;
     }
   return ++x + bar ();
 }

Another thing that I would like to add would be a short comment at the
beginning of a function that explains what the function does (unless the
function is only a few lines or very simple).

Arun

[1] http://www.gnu.org/prep/standards/standards.html#Formatting



reply via email to

[Prev in Thread] Current Thread [Next in Thread]