octave-maintainers
[Top][All Lists]
Advanced

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

Octave coding style questions


From: Rik
Subject: Octave coding style questions
Date: Sun, 12 Jan 2020 10:38:26 -0800

All,

I recently style-checked the Octave code base using a combination of astyle
set for GNU coding standards and some Perl post-processing.  It still
requires too much human inspection to review what the scripts find.  One of
the recurring issues that gets flagged is the indentation of enum blocks. 
The current code uses double indentation as is done for flow-control blocks
like those following if, for, while, etc.

enum color
  {
    RED,
    GREEN,
    BLUE
  };

astyle would like to remove the extra indent and make this

enum color
{
  RED,
  GREEN,
  BLUE
};

I don't think it particularly matters, and would prefer to let astyle
correct this and then stop harassing me.  Are there any useful arguments
agains this change?

On a related note, how should class definitions being handled?  In some
cases we use the C++ keyword followed immediately by the class name, and in
other cases "class" appears by itself followed by the name of the class on
it's own line.  This is vaguely similar to the way we define functions
where the return value appears first on its own line followed by the name
of the function.  Examples:

Style #1
class callback_props
{

Style #2
class
callback_event
{

A second decision is whether parent classes  should appear on the line with
the name of the class, or also on their own

Style #1
class
callback_event : public base_graphics_event
{

Style #2
class
callback_event
  : public base_graphics_event
{

--Rik



reply via email to

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