0

See the below. I have two definitions of a floating point array. The latter is valid with C++11.

The first one is auto indented in a sane fashion. The second one looks like emacs just doesn't know what to do with it.

I don't really care that much what the auto-indenter decides to do as long as it doesn't look irrational.

Is there a way to fix this or workaround it?

Here is the C++ code, formatted as by the emacs indent-region function:

int main() {

  // looks good to me
  float nums[9] =
    {
      1., 2., 3.,
      4., 5., 6.,
      7., 8., 9.,
    };

  // wtf
  float * numsp = new float[9]
  {
    1., 2., 3.,
      4., 5., 6.,
      7., 8., 9.,
      };

}

1 Answer 1

1

I see this with c++-mode, but not with c-mode. Consider filing a bug report to fix it for C++ mode: M-x report-emacs-bug.

There's also a related, more-general thread about fixing such indentation of data, in [email protected].

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.