Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Curly braces

Curly braces

Scheduled Pinned Locked Moved The Lounge
hostingcloud
43 Posts 25 Posters 58 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • pkfoxP pkfox

    Are you in this camp

    void AFunc(){
    }

    or this one

    void AFunc()
    {
    }

    I'm in the second

    Life should not be a journey to the grave with the intention of arriving safely in a pretty and well-preserved body, but rather to skid in broadside in a cloud of smoke, thoroughly used up, totally worn out, and loudly proclaiming “Wow! What a Ride!" - Hunter S Thompson - RIP

    J Offline
    J Offline
    Jeremy Falcon
    wrote on last edited by
    #41

    This is the only correct way:

    void AFunc() {
    }

    Embrace it. Join the dark side. :-\

    Jeremy Falcon

    1 Reply Last reply
    0
    • G Gary R Wheeler

      The first style is usually called "K&R", while the second is often named Allman. There are countless variations based on indentation of the following code body. I started out using K&R when I learned 'C' from, er, the K&R. When I learned C# where the convention leans hard toward Allman, I found I preferred Allman braces. I have significant visual problems: myopia, astigmatism, presbyopia, and glaucoma in the left eye, and the right one is made of plastic. Did I mention the cataract forming in the left eye? Allman adds white-space and highlights braces, both of which improve readability greatly for me. One good thing about venerable VS2008 still being an active tool in our shop is that I have a Visual Studio editor macro that converts K&R style to Allman. I don't like the reformatters in later editions of Visual Studio.

      Software Zen: delete this;

      J Offline
      J Offline
      Jeremy Falcon
      wrote on last edited by
      #42

      I'm totally K&R, but I upvoted this anyway just because you're cool. #no_shame

      Jeremy Falcon

      G 1 Reply Last reply
      0
      • J Jeremy Falcon

        I'm totally K&R, but I upvoted this anyway just because you're cool. #no_shame

        Jeremy Falcon

        G Offline
        G Offline
        Gary R Wheeler
        wrote on last edited by
        #43

        Thanks Jeremy. Glad to see you coming around here again!

        Software Zen: delete this;

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups