Re: coding style

Arun Persaud <[email protected]>
Newsgroups gmane.comp.gnu.xboard.devel
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.