• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

Is C a 'good' programming language?

Collapse
X
  •  
  • Filter
  • Time
  • Show
Clear All
new posts

    #91
    Originally posted by zeitghost
    Not to mention the style war over the positioning of the "{"...

    I like to line the "{" and the "}" up.


    I used to do the end of the line, as in my example, much to the annoyance of the people that worked for me. But I had a contract a few years ago with somebody who insisted on the braces lining up, and so I learned. Now I look at my old code with horror.

    It's not like any of that whitespace is significant. It would be an extrodinarily crap language that made tabs and equivalent number of spaces mean different things (yes I'm talking about you, Python ).

    The problems of coding style are largely solved if you just work by yourself on everything. It's other people that cause the problems.
    Will work inside IR35. Or for food.

    Comment


      #92
      Originally posted by VectraMan View Post


      I used to do the end of the line, as in my example, much to the annoyance of the people that worked for me. But I had a contract a few years ago with somebody who insisted on the braces lining up, and so I learned. Now I look at my old code with horror.

      It's not like any of that whitespace is significant. It would be an extrodinarily crap language that made tabs and equivalent number of spaces mean different things (yes I'm talking about you, Python ).

      The problems of coding style are largely solved if you just work by yourself on everything. It's other people that cause the problems.
      I believe Haskell may be the same.

      Back in uni we had to work with a hardware specification language called maude, generally it was ok. However it had a random tendency of ignoring comment markers and treating the comments as code, so you ended up not using comments!

      I was recently (well not that recently anymore) working with a client where I was doing Java and c#, switching between them every 5-10 minutes at times. Now that really starts to mess with your head after a while, especially with there different bracketing styles.

      Comment


        #93
        Just thought I'd let you guys know. 3 Interviews in 7 days. Blown out.

        Oh well, not meant to be!!!

        Comment


          #94
          Originally posted by zeitghost
          Not to mention the style war over the positioning of the "{"...

          I like to line the "{" and the "}" up.
          Absolutely agree.

          Mind you, the original Kernighan and Ritchie text used a bit of a mixture of styles there. Inconsistent treatment of braces all over the shop.

          In their learned tome "The C Programming Language", Function and Struct braces normally begin on a new-line with everything using line-end styles, with the 'odd' exception.

          Sometimes they left braces out altogether: -

          Code:
          if (this)
              do this;
          else
              do that;
          
          vs.
          
          if (this)
          {
             do this;
          }
          else
          {
              do that;
          }
          Or worse...

          Code:
          for (i = 0; i < j; i++)
              do stuff;
          Personally I think that's horrible. Braces cost nothing and add to code readability no end IMO.

          New-line, correctly indented braces for me every time, even when not syntactically necessary.
          Last edited by bogeyman; 27 August 2009, 15:01.

          You've come right out the other side of the forest of irony and ended up in the desert of wrong.

          Comment


            #95
            Originally posted by bogeyman View Post
            Absolutely agree.

            Mind you, the original Kernighan and Ritchie text used a bit of a mixture of styles there. Inconsistent treatment of braces all over the shop.

            In their learned tome "The C Programming Language", Function and Struct braces normally begin on a new-line with everything using line-end styles, with the 'odd' exception.

            Sometimes they left braces out altogether: -

            Code:
            if (this)
                do this;
            else
                do that;
            Or worse...

            Code:
            for (i = 0; i < j; i++)
                do stuff;
            Personally I think that's horrible. Braces cost nothing and add to code readability no end IMO.

            New-line, correctly indented braces for me every time, even when not syntactically necessary.
            WHS in spades!!!

            Test for a result, not an operation!

            Much more readable!!!

            Comment


              #96
              Originally posted by Churchill View Post
              Just thought I'd let you guys know. 3 Interviews in 7 days. Blown out.


              Originally posted by Churchill View Post
              Oh well, not meant to be!!!
              It wasn't; some of the things you've said suggest you would have not quite fitted what they were after.

              Originally posted by Churchill View Post
              It's all good practice. And you must have been doing something right.
              My all-time favourite Dilbert cartoon, this is: BTW, a Dumpster is a brand of skip, I think.

              Comment


                #97
                Originally posted by Churchill View Post
                Just thought I'd let you guys know. 3 Interviews in 7 days. Blown out.

                Oh well, not meant to be!!!

                Sorry chap, missed that bit.

                Keep your pecker up - 3 interviews in a week is pretty damn good going, so you must be doing something right.

                You've come right out the other side of the forest of irony and ended up in the desert of wrong.

                Comment


                  #98
                  Originally posted by bogeyman View Post
                  Sorry chap, missed that bit.

                  Keep your pecker up - 3 interviews in a week is pretty damn good going, so you must be doing something right.
                  3 interviews with the same f**king company!

                  Comment


                    #99
                    Originally posted by bogeyman View Post
                    Sometimes they left braces out altogether: -
                    I hate that because it's too easy to do:

                    Code:
                    if(x)
                        Something()
                        SomethingElseIThinkIsInTheCondition()
                    Or...

                    Code:
                    if(x)
                        // SomethingTemporarilyCommentedOut()
                    SomethingElseWhichIsNowInTheCondition()
                    Bad luck on the jobs. Not even a sniff of an interview for me.
                    Will work inside IR35. Or for food.

                    Comment


                      Originally posted by VectraMan View Post
                      I hate that because it's too easy to do:

                      Code:
                      if(x)
                          Something()
                          SomethingElseIThinkIsInTheCondition()
                      Or...

                      Code:
                      if(x)
                          // SomethingTemporarilyCommentedOut()
                      SomethingElseWhichIsNowInTheCondition()
                      Bad luck on the jobs. Not even a sniff of an interview for me.
                      Churchill - In "Something will crop up" Optimistic mode.

                      Comment

                      Working...
                      X