xboard-devel
[Top][All Lists]
Advanced

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

Re: [XBoard-devel] coding style


From: Arun Persaud
Subject: Re: [XBoard-devel] coding style
Date: Mon, 02 Jan 2012 17:07:15 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:9.0) Gecko/20111220 Thunderbird/9.0

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]