Thread: What's the most commonly used indentation in c++?

  1. #1
    Registered User
    Join Date
    Sep 2018
    Posts
    217

    What's the most commonly used indentation in c++?

    What's the most commonly used indentation in c++? And where can I find the rules for it and other coding conventions in C++?

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    I suggest picking either a K&R variant or Allman style. The rules for these can easily be found by searching the Web. Also, read Stroustrup's answer to the FAQ: Which layout style is the best for my code?, especially the end.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > What's the most commonly used indentation in c++?
    It's a frequent topic of flame wars.
    Indentation style - Wikipedia

    I think the two basic rules being
    1. Do it.
    2. Be consistent.

    > And where can I find the rules for it and other coding conventions in C++?
    Try google.
    coding conventions in C++ - Google Search
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. indentation o indentation!
    By rogster001 in forum C++ Programming
    Replies: 18
    Last Post: 09-23-2009, 05:53 AM
  2. Why are #define macros commonly used in C?
    By noerrorsfound in forum C Programming
    Replies: 14
    Last Post: 09-11-2009, 02:49 PM
  3. commonly used idioms
    By cmay in forum C Programming
    Replies: 7
    Last Post: 07-08-2009, 03:42 PM
  4. Commonly used libraries
    By Jaken Veina in forum C Programming
    Replies: 7
    Last Post: 04-05-2005, 05:32 PM
  5. Dev C++ Compiler, Indentation?
    By Zeusbwr in forum C++ Programming
    Replies: 3
    Last Post: 10-21-2004, 06:13 AM

Tags for this Thread