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. General Programming
  3. C / C++ / MFC
  4. What type of c source do you prefer?

What type of c source do you prefer?

Scheduled Pinned Locked Moved C / C++ / MFC
question
6 Posts 6 Posters 0 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.
  • F Offline
    F Offline
    fat888
    wrote on last edited by
    #1

    There are two c types, one is: if(...) { ... } else { ... } the other is: if(...){ ... ... }else{ ... ... } Witch one do you prefer? And why?

    Hi guys. I'm a very man. Do you like fat men?

    R _ R C J 5 Replies Last reply
    0
    • F fat888

      There are two c types, one is: if(...) { ... } else { ... } the other is: if(...){ ... ... }else{ ... ... } Witch one do you prefer? And why?

      Hi guys. I'm a very man. Do you like fat men?

      R Offline
      R Offline
      Rinu_Raj
      wrote on last edited by
      #2

      We prefer the following because it has got more readability than the other if(...) { ... } else { ... } Rinu Raj

      1 Reply Last reply
      0
      • F fat888

        There are two c types, one is: if(...) { ... } else { ... } the other is: if(...){ ... ... }else{ ... ... } Witch one do you prefer? And why?

        Hi guys. I'm a very man. Do you like fat men?

        _ Offline
        _ Offline
        _AnsHUMAN_
        wrote on last edited by
        #3

        Both the ways. It's just upto you what you feel better to work with. IMO the first option offers more readabilty and indentation for your code is also very clear. So I prefer to go with the first option.

        Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_

        1 Reply Last reply
        0
        • F fat888

          There are two c types, one is: if(...) { ... } else { ... } the other is: if(...){ ... ... }else{ ... ... } Witch one do you prefer? And why?

          Hi guys. I'm a very man. Do you like fat men?

          R Offline
          R Offline
          Robert Buldoc
          wrote on last edited by
          #4

          The first one! Easier on the eyes.

          1 Reply Last reply
          0
          • F fat888

            There are two c types, one is: if(...) { ... } else { ... } the other is: if(...){ ... ... }else{ ... ... } Witch one do you prefer? And why?

            Hi guys. I'm a very man. Do you like fat men?

            C Offline
            C Offline
            Christian Graus
            wrote on last edited by
            #5

            I've never seen variation 2, although I see a lot of if { } else{ } Either way, my vote is for 1.

            Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

            1 Reply Last reply
            0
            • F fat888

              There are two c types, one is: if(...) { ... } else { ... } the other is: if(...){ ... ... }else{ ... ... } Witch one do you prefer? And why?

              Hi guys. I'm a very man. Do you like fat men?

              J Offline
              J Offline
              Joe Woodbury
              wrote on last edited by
              #6

              I prefer the first; it's easier to identify scope with brackets that line up. It also puts some white space between the if (or other leading statements) and code inside the scope. (I also tend to put a blank line before the if.)

              Anyone who thinks he has a better idea of what's good for people than people do is a swine. - P.J. O'Rourke

              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