C++ and m/c/realloc with Native Types

This is a discussion on C++ and m/c/realloc with Native Types within the C++ Programming forums, part of the General Programming Boards category; Just being thorough. And more importantly, answering the original poster's question. I have had to do this before so I ...

  1. #16
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    Just being thorough. And more importantly, answering the original poster's question. I have had to do this before so I can see where he may be stuck with using the exception to the rule.

  2. #17
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    23,801
    Quote Originally Posted by master5001
    I hope someone brought up the placement new operator at some point.
    Yes, I did, on post #9, but I noted that it is only suitable when hidden behind the class (template) interface.

    Quote Originally Posted by matsp
    Yes, but that is REALLY not a good idea except in very special cases.
    One common "special case" would be to avoid unnecessary default initialisation of objects.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #18
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    Thanks laserlight. I figured surely someone would have by now. I hope everyone picked on your equally for bringing it up. Though I think I just attract negative attention for you guys (thanks everyone, I love you all--really).

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21