Tab or No Tab :: C++ Compilers

Sharky Forums


Results 1 to 5 of 5

Thread: Tab or No Tab :: C++ Compilers

  1. #1

    Post Tab or No Tab :: C++ Compilers

    Hi,

    I program using Visual C++, vi, some occassionally using KDevelop. I usually experience problems with tabs and spaces. I use tab (3 spaces) in Visual C++. However, vi almost always open the source files with random spaces.

    In general, do developers use spaces instead of tabs?

    Thanks,
    Kuphryn

  2. #2
    Reef Shark mefisto3's Avatar
    Join Date
    Jul 2001
    Location
    Melbourne, Vic, Australia
    Posts
    429

    Post

    Usually use spaces. Tabs can always screw up when you move the code to a different editor or machine. Most of editors now support an option to change the tabs to spaces.

  3. #3
    Hammerhead Shark
    Join Date
    Feb 2001
    Posts
    1,612

    Post

    Here's my advice. You can use tabs or spaces (or a combination of both, as vi will do with ^T and shiftwidth), BUT a TAB is eight spaces. Always. Do not screw with that unless you absolutely have to (i.e. director of the project tells you to).

  4. #4

    Post

    Thanks everyone.

    I set Visual C++ to use *spaces* when I hit the tab key. This method works great. Thanks!

    Kuphryn

  5. #5
    NullPointerException rock's Avatar
    Join Date
    Sep 2000
    Location
    York, PA
    Posts
    6,203

    Post

    I'd say always use spaces. As implied above, TABs are sometimes different spaces - either in different software or on different OSes. (usually 4 or 8, though).

    Since many editors won't show you what's a tab or space, it's much safer to just stick to spaces. Reading through our source code, it's obvious when 2 people have been in a file and used different editors... Very ugly.

    Besides, indenting with 3-space increments looks so much better, especially when sticking to 80-character lines. Otherwise you end up with a column down the right margin :P

    ------------------
    The price of freedom is high.

    Open Source is free like a puppy is free.

    It's only when you look at an ant through a magnifying glass on a sunny day that you realise how often they burst into flames.

    Understanding Evolution

Posting Permissions

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