Find the answer to your Linux question:
Results 1 to 7 of 7
Hi There! This is a shout out to all you hardcore C++ programmers out there. First of all, let me say that I respect the C++ programming language. It was ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jan 2004
    Location
    Belize C.A.
    Posts
    10

    [C++] Reference Counter Class


    Hi There!
    This is a shout out to all you hardcore C++ programmers out there.

    First of all, let me say that I respect the C++ programming language. It was the first programming language that I took a whack at. I believe that C++ has given birth to many sofisticated software packages, and probably laid a foundation for some new breed OOP languages such as Java, C# and the like. However, as much as I like C++, I must admit that memory management can sometimes be a real nightmare if not dealt with properly. This is why I seek those techniques that relief the memory management burden in C++ and place them on the language itself. I was made to understand that one such technique is the use of Reference Counters. I beleive this makes use of the template mechanism in C++ which as I see it, emulates a loosely typed environment such as those in scripting languages like JavaScript, while still provinding type checking. I hope this makes some sense rather than sounding ridiculous.

    I was making some observations in the libsigc++ (the signal slot) library code in which they make use of such techniques. However I am still having trouble understaning this concept fully. Somehow the use of templates combined with inheritance still have me a bit puzzled.

    I would really appreciate if someone out there had an example or article that elaborated on the subject a bit. Or if someone knows of a particular website dedicated to this subject. I really want to become a better C++ programmer. And despite what people say about C++, I believe that its benefits outweigh its weaknesses. And I am certain that C++ is such a powerful language that, it can patch itself up if the proper technique is applied.

    Thanks in advance!

  2. #2
    Just Joined!
    Join Date
    Nov 2002
    Location
    USA
    Posts
    99
    I don't know of any article or website that is dedicated specifically to the combination of inheritance and templates, but here's a few links to some sites that you may be able to search for info:

    http://www.cetus-links.com/
    http://www.cuj.com/

    Also, here's a site with links to articles from the C++ report:
    http://www.langer.camelot.de/Articles/C++Report.html

    Also, here's a list of books that may help.

    This one's suppossed to be from the designers of the language, although I believe Bjarne Stroustrup is the original creator of C++:
    C++ Standard Template Library, The
    by P.J. Plauger (Author), Alexander A. Stepanov (Author), Meng Lee (Author), David R. Musser (Author)

    Also, I've read this one and found it to be very clear and concise:
    The C++ Standard Library : A Tutorial and Reference
    by Nicolai M. Josuttis (Author)

    Also, since reference counting is a design pattern you may find this helpful as well. It's my personal favorite book ever on programming:
    Design Patterns
    by Erich Gamma (Author), Richard Helm (Author), Ralph Johnson (Author), John Vlissides (Author)

    Also, maybe I can help some. Is it part of some code that you are reading that is puzzling you or is it the concept of inheritance and/or templates?

  3. #3
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    I realize that this might not be the answer you want, but I suggest that you stay away from C++ and use C instead. In my opinion, C++ is the most unnecessary addition to any lanuage that has ever been made. Its sole purpose is to make C more "user-friendly", and to achieve that purpose, it demands an additional compiler and lots of additional libraries. There is nothing that you can do in C++ that you can't do in C. When it comes to memory management, C++ tries to hide it from you, which I believe just makes it even worse. At least in C, memory management is clear and concise.

  4. #4
    Just Joined!
    Join Date
    Nov 2002
    Location
    USA
    Posts
    99
    Face it Dolda2000, you just have a thing against object-oriented programming?
    Did some object-oriented programmer rub you the wrong way?
    Act elitest or something? What gives?

  5. #5
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    No, I don't mind OOP in itself. I have nothing against languages like Java or LISP. C++, on the other hand - I just don't see the point of it. It's just a bloated preprocessor that generates bloated and more error-prone code. At least I haven't been able to view it any other way, no matter how hard I've tried.

  6. #6
    Just Joined!
    Join Date
    Nov 2002
    Location
    USA
    Posts
    99
    Alright, I'd have to agree with that. They probably should have never made C++ as an add on to C. They should have created a completely different language. And I'd have to say, that given the choice, I'd use Java or (heaven forbid) C# over C++.

  7. #7
    Just Joined!
    Join Date
    Jan 2004
    Location
    Belize C.A.
    Posts
    10

    Thanks for the help... I think!

    Thanks for the help; as for the contraversy between opinions, I guess everyone will have their own.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •