XCode & braces

Joined
Sep 20, 2008
Messages
17
Reaction score
0
Points
1
Location
Surrey, UK
I don't like the K&R style, i.e.:

void Foo {
int n = 0;
...
}

I prefer the BSD style, which is prevalent among all the programmers I have worked with and which I prefer (it is easier to read):

void Foo
{
int n = 0;
...
}

How can I set XCode to use the BSD style, as currently it is setup for the K&R style? I have looked through the preferences but cannot see where!
 
Joined
Aug 17, 2008
Messages
30
Reaction score
2
Points
8
Your Mac's Specs
Mac mini 1.66 GHz Intel Core Duo / 1GB 667 MHz DDR2 SDRAM / 80GB HD
I think you are S.O.L. Spook. I looked through myself and could not find anything. What's even better, I google "K&R xcode" .... yeah, this thread is top search result :(
 
Joined
Jan 24, 2009
Messages
2
Reaction score
0
Points
1
I don't like the K&R style, i.e.:

void Foo {
int n = 0;
...
}

I prefer the BSD style, which is prevalent among all the programmers I have worked with and which I prefer (it is easier to read):

void Foo
{
int n = 0;
...
}

How can I set XCode to use the BSD style, as currently it is setup for the K&R style? I have looked through the preferences but cannot see where!

Code:
$ defaults write com.apple.Xcode XCCodeSenseFormattingOptions -dict BlockSeparator "\\n"

I use the Allman style (as it is cited in the ANSI C standard) and it too has an equivalent brace placement style.

Other various code style preferences: Xcode User Default Reference: Source Code Formatting User Defaults
 
Joined
Jan 24, 2009
Messages
2
Reaction score
0
Points
1
Just to supplement, this only applies to macros and code completion, not file templates. You'll need to "fix" the templates yourself.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top