Results 1 to 4 of 4

Thread: XCode & braces

  1. #1

    Spook's Avatar
    Member Since
    Sep 20, 2008
    Location
    Surrey, UK
    Posts
    17
    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!

  2. #2

    kevindryer39's Avatar
    Member Since
    Aug 17, 2008
    Posts
    30
    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

  3. #3


    Member Since
    Jan 24, 2009
    Posts
    2
    Quote Originally Posted by Spook View Post
    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

  4. #4


    Member Since
    Jan 24, 2009
    Posts
    2
    Just to supplement, this only applies to macros and code completion, not file templates. You'll need to "fix" the templates yourself.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Xcode & gcc
    By namu in forum OS X - Operating System
    Replies: 2
    Last Post: 07-13-2012, 12:15 AM
  2. Replies: 6
    Last Post: 03-09-2012, 02:42 PM
  3. Xcode stopped letting me run Xcode app on iPad
    By ildsarria in forum iOS Development
    Replies: 1
    Last Post: 11-09-2011, 03:15 PM
  4. NAS & Time Machine & Lion & Homeplug
    By ovbg in forum Other Hardware and Peripherals
    Replies: 6
    Last Post: 11-04-2011, 01:21 AM
  5. SDL & Xcode problem
    By jimz in forum OS X - Development and Darwin
    Replies: 0
    Last Post: 02-17-2009, 12:03 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •