• 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

    #31
    Originally posted by NickFitz View Post
    Maybe it's just me but that seems to conflict with:

    In the case you describe you are trusting that the compiler will take care of your problems for you.
    Yes that's fair. But the difference is that I'd be able to test it. I'd put a breakpoint in the destructor to make sure what the compiler was doing was what I thought it would do. With GC you can't do anything other than trust the runtime works as advertised.

    Instead, you should explicitly release resources once you no longer have any need of them; the associated memory allocation and release will happen behind the scenes. This paradigm gives you something extra to think about in the case you describe, but it gives you a lot less to think about in many other common cases. Many people believe the tradeoff to be worthwhile.
    Yes, and it's requiring an explicit operation that makes it more like C than C++. But I don't see any fundamental difference in paradigm. In fact most of what I do with C++ uses reference counting, which as long as you're careful not to fall into the circular reference trap is the same approach to programming: create objects and don't worry about explicitly deleting them.

    So it's not a trade off. C++ allows the programmer to choose several different approaches, including the one use by C#/Java, or invent his own from scratch if appropriate. Whereas C#/Java forces you to use just the one.

    Of course I'd rather write assembler and ignore all this OOP nonsense.
    Will work inside IR35. Or for food.

    Comment


      #32
      Originally posted by crabfoot View Post
      C+, C++, C# and Java are not separate languages - they are all adaptations of C, written with the objective of producing clean, understandable, and reliable structured code.
      What a load. They are all entirely separate languages (ok C++ is a direct superset of C) that share a very similar syntax. That doesn't mean they're the same languages at all. Sure, Java is clearly inspired by C++ and C# is inspired by both, but that's not the same thing at all.
      For instance, all .net languages are fundamentally the same - C#.net and VB.net are more functionally similar than C & C#.
      Originally posted by MaryPoppins
      I'd still not breastfeed a nazi
      Originally posted by vetran
      Urine is quite nourishing

      Comment


        #33
        What I was saying is that one of the most powerful things that C++ has over C is the ability to create an object on the stack that manages something, be it memory, a file, access to data, whatever, and you know that its destructor will be called and when, because the compiler guarantees it. C#/Java doesn't have that (except for "using" in C# which is similar), and whilst it's okay for GC to take care of memory, you wouldn't want to wait for GC to take care of closing a file that you can't keep open, for example, because you don't know when it will happen.
        In C# you would implement IDisposable.

        http://msdn.microsoft.com/en-us/libr...5e(VS.71).aspx

        The file would be closed by giving the caller a Dispose method in this way, or if the resource can be re-opened (such as a file handle) by giving the caller an Open and a Close method.

        http://msdn.microsoft.com/en-us/libr...tw(VS.71).aspx

        There's no issue here. Either the caller will use these methods directly or they are implicitly used by the using() {} construct in C#. This has nothing to do with the garbage collector or the finalize destructor.

        Comment


          #34
          Originally posted by d000hg View Post
          For instance, all .net languages are fundamentally the same - C#.net and VB.net are more functionally similar than C & C#.
          C++ is a .NET language.
          Will work inside IR35. Or for food.

          Comment


            #35
            Originally posted by VectraMan View Post
            C++ is a .NET language.
            So is COBOL

            IMO the reason so many of you hate 'C' is because you're lazy bastards.

            Comment


              #36
              Does anyone have any comments on Objective-C in this context?

              (I've not done what I'd call in-depth C or C++ development work. I came up the FORTRAN and COBOL route where the compiler took care of things.)
              Behold the warranty -- the bold print giveth and the fine print taketh away.

              Comment


                #37
                Originally posted by Churchill View Post
                So is COBOL

                IMO the reason so many of you hate 'C' is because you're lazy bastards.
                WHS

                C is a great language. Small and powerful. Lethal in the wrong hands, of course (i.e. many of the above posters).

                Still have my dog-eared K&R "The C Programming Language".

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

                Comment


                  #38
                  Originally posted by VectraMan View Post
                  C++ is a .NET language.
                  Yes but few people mean C++.net when they say C++. Most people mean ANSI (or some close attempt) C++, not managed C++.

                  You missed your <pedant> tag...
                  Originally posted by MaryPoppins
                  I'd still not breastfeed a nazi
                  Originally posted by vetran
                  Urine is quite nourishing

                  Comment


                    #39
                    Originally posted by bogeyman View Post
                    WHS

                    C is a great language. Small and powerful. Lethal in the wrong hands, of course (i.e. many of the above posters).

                    Still have my dog-eared K&R "The C Programming Language".
                    More work for us Bogey old chum!

                    Comment


                      #40
                      Originally posted by Churchill View Post
                      IMO the reason so many of you hate 'C' is because you're lazy bastards.
                      Damn right. I'm very lazy, why bother reinventing the wheel?
                      Originally posted by MaryPoppins
                      I'd still not breastfeed a nazi
                      Originally posted by vetran
                      Urine is quite nourishing

                      Comment

                      Working...
                      X