This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Coding style


Hi folks,

I've been noticing that some folks (most notably Andrew :-) have been
very "economical" in the use of empty lines in function bodies.  I
know that the GNU coding standards say that one should not use too
many of those, but I think there are good reasons to keep with the
tradition of seperating the declaration of local variables from
geneuine code by an empty line, e.g.:

int
max_register_size (struct gdbarch *gdbarch)
{
  struct regcache_descr *descr = regcache_descr (gdbarch);

  return descr->max_register_size;
}

instead of:

int
max_register_size (struct gdbarch *gdbarch)
{
  struct regcache_descr *descr = regcache_descr (gdbarch);
  return descr->max_register_size;
}

I keep finding the first much more legible.  AFAICT all GNU projects
that take the coding standards serious use that style.  By the way,
using whitespace to logically group lines together within a function
body is generally a good idea too.  Well, IMHO of course...

Anyway, I hope no one will object if add a few extra newlines
here'n'there when I feel it's appropriate?

Mark


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]