CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 2 FirstFirst 12
Results 16 to 21 of 21
  1. #16
    Join Date
    Jun 2002
    Location
    Germany
    Posts
    1,557

    Re: Tasteless mimic of operator new: Call ctor

    Lindley, I can't add to your rep any more because the box won't let me. Wants me to spread it around.

    But you rock. All the other gurus too.

    Bye, Chris.
    You're gonna go blind staring into that box all day.

  2. #17
    Join Date
    Jul 2005
    Location
    Netherlands
    Posts
    2,042

    Re: Tasteless mimic of operator new: Call ctor

    Quote Originally Posted by dude_1967 View Post
    There will be no corresponding calls to delete in these designs.
    When you use placement new, you shouldn't call delete, but you should call the destructor explicitly.
    Cheers, D Drmmr

    Please put [code][/code] tags around your code to preserve indentation and make it more readable.

    As long as man ascribes to himself what is merely a posibility, he will not work for the attainment of it. - P. D. Ouspensky

  3. #18
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    10,895

    Re: Tasteless mimic of operator new: Call ctor

    Well, placement delete. However, that isn't necessary if the types in question don't allocate resources internally, which may be the case here.

  4. #19
    Join Date
    Jun 2002
    Location
    Germany
    Posts
    1,557

    Re: Tasteless mimic of operator new: Call ctor

    Thanks for the further suggestions.

    The types I am creating with placement new never delete. They also don't alocate any further resources internally.

    It's kind of a funny region --- the world of tiny embedded systems. You turn on your microcontroller, initialize your CPU, stack-pointer, hardware, SRAM, stack, ctors, etc. Then you might make your singleton instances, as run-time progresses, with placement new.

    The microcontroller runs and runs and runs until someone mercifully switches it off. main does not return. It's a different kind of design than most people are used to. For this design, I am making a kind of "one-shot" heap.

    I've got it all under control now.

    Again, thanks for all the help. I always get good answers at codeguru.

    Sincerely, Chris.
    You're gonna go blind staring into that box all day.

  5. #20
    Join Date
    Jul 2002
    Location
    Portsmouth. United Kingdom
    Posts
    2,727

    Re: Tasteless mimic of operator new: Call ctor

    This article by Dr Dobbs may be of some use or inspiration.

    http://www.drdobbs.com/184403759

    I used information from here to help design allocators that grabbed space from the stack.
    "It doesn't matter how beautiful your theory is, it doesn't matter how smart you are. If it doesn't agree with experiment, it's wrong."
    Richard P. Feynman

  6. #21
    Join Date
    Jul 2002
    Location
    Portsmouth. United Kingdom
    Posts
    2,727

    Re: Tasteless mimic of operator new: Call ctor

    Quote Originally Posted by dude_1967 View Post
    It's kind of a funny region --- the world of tiny embedded systems.
    Up until my current job all my work was with embedded systems (6809, 68000). I used to quite enjoy it. There was no OS; If you wanted to print to the screen you had to first write the code that took the output from printf and wrote the pixels to the video memory from your own bitmap font definitions. Ah, those were the days.. (Sits back in chair basking in warm rosey glow of nostalgia )
    "It doesn't matter how beautiful your theory is, it doesn't matter how smart you are. If it doesn't agree with experiment, it's wrong."
    Richard P. Feynman

Page 2 of 2 FirstFirst 12

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured