0

Most of the code formatters I found handle indents and some extra spacing, but very few fix the curly brackets that go on a new line. Does anyone have any idea how these various styles of placing the curly brackets are called?

Also, is there an online code formatter for this?

Currently I'm using my own quick'n'dirty Python script.

Tudor
  • 4,137
  • 5
  • 38
  • 54

2 Answers2

3

A good one is Artistic Style. It does C, C++, C#, and Java and can format code via the command line or can be used in your formatter (should you want to make one). It looks like Uncrustify does Objective-C, in addition to C, C++, C#, D, Java, and Pawn.

As for the specific curly brace styles, Wiki has a good summary of most of them. For example, there's K&R, BSD/Allman (my favorite), and others.

I don't know many online code formatters, but I have heard about PrettyPrinter. This answer has some additional formatters you may want to check out.

Community
  • 1
  • 1
Gemini14
  • 6,246
  • 4
  • 28
  • 32
0

If you are using Linux, you can use indent (C/C++, I've never used it for Object-C but it should work for it). Default style of indent is GNU style
Example:

indent [options] [filename]

There is also online tools for C/C++:
http://www.tutorialspoint.com/online_c_formatter.htm
or for other languages:
http://prettyprinter.de/

HiramHakim
  • 24
  • 4