[PPL-devel] Macro formatting

Matthew Mundell mattm at comp.leeds.ac.uk
Sun Sep 18 20:20:27 CEST 2005


Hi

1) The macro invocations in the checked* files lack trailing
   semicolons.  I think that it's usual to leave the semicolon off the
   end of the macro definition, and to add it after the invocation.
   This makes the invocation look like a function call, at least for
   indentation and highlighting in editors.

2) The macro definitions, at least in the checked* files, could be
   neater.  The macros are like this:

#define SPECIALIZE_FUN3_0_1(name, suf, ret_type, qual1, type1, qual2, type2, qual3, type3, after1) \
template <typename Policy> \
struct FUNCTION_CLASS(name) <Policy, type1, type2, type3> { \
  static inline Result function(qual1 type1& arg1, qual2 type2 &arg2, qual3 type3 &arg3, after1 a1) { \
    return name ## _ ## suf<Policy>(arg1, arg2, arg3, a1); \
  } \
};

    and they could be like this:

#define SPECIALIZE_FUN5_0_1(name, suf, ret_type,                        \
                            qual1, type1, qual2, type2, qual3, type3,   \
                            qual4, type4, qual5, type5, after1)         \
template <typename Policy>                                              \
struct FUNCTION_CLASS(name) <Policy,                                    \
                             type1, type2, type3, type4, type5> {       \
  static inline Result                                                  \
  function(qual1 type1& arg1, qual2 type2 &arg2, qual3 type3 &arg3,     \
           qual4 type4 &arg4, qual5 type5 &arg5, after1 a1) {           \
    return name ## _ ## suf<Policy>(arg1, arg2, arg3, arg4, arg5, a1);  \
  }                                                                     \
};

    Emacs can handle the \'s and the indentation, with indent-region
    (bound to C-M-\).

Is there any interest in improving this formatting?

Thanks



More information about the PPL-devel mailing list