On 1/12/20 4:02 PM, Mike
Miller wrote:
On Sun, Jan 12,
2020 at 10:38:26 -0800, Rik wrote:
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?
No, and this change is consistent with the GNU standards
(https://www.gnu.org/prep/standards/html_node/Formatting.html#index-enum-types_002c-formatting)
This change is fine with me, though Emacs CC mode with the gnu
style appears to indent the enum block by default but it
shouldn't be too hard to change that.
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
{
I think the first choice is more sensible here. The GNU C
style does not
recommend splitting after the keyword "enum" or "struct" for
example,
and "class" is in the same family as "enum" and "struct" in
C++.
Yes, style #1 seems better to me as well.
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
{
I think the first choice is more sensible here, with the
"class" keyword
also on the same line
class callback_event : public base_graphics_event
{
When the class names are long enough to warrant folding, then
colon
makes sense as a fold point
class exceptionally_long_derived_class_name
: public exceptionally_long_base_class_name
{
I agree.
jwe