0

Invalid auto-indentation in "if" statement on C-like languages

David Capello il y a 12 ans mis à jour par Ryan Park il y a 12 ans 3

With the following code on C/C++/JavaScript/C-like languages: (note: _ is the cursor position)

  if (a == b ||
      c == d) _
If we press { and then ENTER key, we get:
if (a == b ||
    a == c) {
        _
    }

Which is invalid, we should get:

if (a == b ||
    a == c) {
    _
}

Even jQuery source code use this kind of indentation.
+1
It's quite interesting to see that people can vote down a bug. lol
Yes I agree, this indentation style is not uncommon.