Thread: Need help from you Xcode users

  1. #1
    Registered User
    Join Date
    Mar 2009
    Posts
    399

    Need help from you Xcode users

    I have set Xcode to always use tabs for indenting as well automatically indent, and everything works just fine except for one thing: It uses tabs to align the code.

    If you're going to use tabs, don't align try to align code with tabs. It simply will not work unless everyone use the same tab size, and there's no way to guarantee that. Is there any way to stop Xcode from aligning the code like this (while keeping the automatic indenting)?

    Also, I don't like the way that is autocompletes stuff like while loops. Can you change this anywhere?

    Xcode:
    Code:
    while (condition) {
            <#statements#>
    }
    My way:
    Code:
    while (condition)
    {
            <#statements#>
    }
    Last edited by Memloop; 09-21-2009 at 07:21 PM.

  2. #2
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Do not use tabs for indenting. It's bad mojo.

    Exactly because of what you are now witnessing and more -- like the excessive indentation on your code blocks above when copy-pasting code from the editor to a forum, or any other target with different tab sizes. I believe that most programmers use spaces these days and the norm is pretty much a tab size of 4 spaces, give or take.

    Anyways, I don't use XCode, so can't help anywhere. Just thought I'd mentioned the tabs issue.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  3. #3
    Registered User
    Join Date
    Mar 2009
    Posts
    399
    I would say it's quite the opposite; people that use spaces for indentation don't respect the fact that other people prefer to have a different indentation width. In the Unix world, tabs with a width of 8 are the norm unless you use Emacs. The whole point of tabs is that it lets programmers use the indentation width that they are the most comfortable with.

    There's no problem with using tabs as long as you stick to one simple rule: Do not align code with tabs!

    EDIT: Actually, my complaint was about Xcode aligning code with tabs lol. That's why it looked strange in other texteditors that use a different tab width.
    Last edited by Memloop; 09-21-2009 at 07:20 PM.

  4. #4
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Yeah. Two different philosophies. We could stay here all night long

    Anyways, Mac is Unix. You should have indent. That should help for now. Hopefully some Mac user will pop in with better info.

    Cheers, and tab's on you.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  5. #5
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Location
    Chappell Hill, Texas
    Posts
    2,332
    I prefer tabs to align code. I find it quite natural.

    Go to Xcode Preferences to turn tabs off:
    Mainframe assembler programmer by trade. C coder when I can.

  6. #6
    Registered User
    Join Date
    Mar 2009
    Posts
    399
    I want to use tabs for indenting, but spaces for aligning the code. The way Xcode does it now is that it uses tabs for indenting, but then goes ahead and uses a combination of tabs and spaces when it aligns the code. That's just ridiculously broken since the tab width can be arbitrary, and sure enough it looks different on editors with a different tab size.

  7. #7
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Location
    Chappell Hill, Texas
    Posts
    2,332
    Oh, I think I understand now. And I meant to say I use tabs for indenting code, not aligning code. I don't use an automated facility for aligning code - just use blanks by hand.

    Just to be clear, you are talking about aligning code such as in the following example?
    Code:
    int  myint          = 50000 ; 
    char mycharacterabc = 'A'   ;
    Mainframe assembler programmer by trade. C coder when I can.

  8. #8
    Registered User
    Join Date
    Mar 2009
    Posts
    399
    Yeah that's one example on when aligning might be desirable, or for example when you can't fit all the function parameters on one line.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 16
    Last Post: 04-20-2008, 01:15 PM
  2. Function validation.
    By Fhl in forum C Programming
    Replies: 10
    Last Post: 02-22-2006, 08:18 AM
  3. Finding users on a network and messaging them.
    By Necrodeemer in forum C++ Programming
    Replies: 3
    Last Post: 05-04-2003, 02:04 PM
  4. Windows ntfs perms
    By wp_x in forum Tech Board
    Replies: 3
    Last Post: 03-04-2003, 06:38 AM