Mac Forums

Mac Forums (http://www.mac-forums.com/forums/)
-   OS X - Development and Darwin (http://www.mac-forums.com/forums/os-x-development-darwin/)
-   -   XCode & braces (http://www.mac-forums.com/forums/os-x-development-darwin/125757-xcode-braces.html)

Spook 10-05-2008 05:57 AM

XCode & braces
 
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!

kevindryer39 10-09-2008 11:01 PM

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 :(

johnjay1 01-24-2009 11:11 AM

Quote:

Originally Posted by Spook (Post 735712)
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

johnjay1 01-24-2009 11:50 AM

Just to supplement, this only applies to macros and code completion, not file templates. You'll need to "fix" the templates yourself.


All times are GMT -4. The time now is 08:02 AM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.