Thread: Delete and vector pointer

  1. #16
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by Elysia View Post
    If it's too slow when looking at a profiler, then I will consider changing it.
    Funny how you apply this argument here. I would suggest the exact same thing but in reverse. Return by value, and profile it to make sure it's not being "stupid."

    It took me a long, long time to realize that pointers suck. Maybe there is hope for you.

  2. #17
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Pointers suck when not wrapped in smart pointers
    That's my experience. Most of the "access violation" I get is with complex, non-C++ish code, such as managing buffers and pointers by hand (which I do avoid).
    Mostly it's old code, written many years ago or so. We improve all the time!
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #18
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    No, I do believe it can do it, but I don't know how or when.
    This may be applicable to you, though it pertains to the 2005 version of Visual C++:
    Named Return Value Optimization in Visual C++ 2005
    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

  4. #19
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    Quote Originally Posted by Elysia View Post
    Pointers suck when not wrapped in smart pointers
    They suck even then. Just a tiny bit less. Value semantics rule.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Popular pages Recent additions subscribe to a feed