digitalmars.D.learn - delete and MmFile
- NewName (10/10) Jan 28 2012 Hello everybody.
- Daniel Murphy (7/9) Jan 28 2012 When delete is gone, you will still be able to destroy class instances w...
- NewName (3/3) Jan 28 2012 Thanks Daniel.
- Daniel Murphy (3/8) Jan 28 2012 Yes. clear is in object.d so it will always be available.
Hello everybody. So I heard that `delete' is being deprecated? If that's true, what can I do to close an MmFile? Or is there another way to create an MmFile object, other than with `new', so that it gets destroyed when out of scope? My problem is, I need to reopen the same file outside an if() block. If the conditional is entered and I don't delete the MmFile in it, my program will crash at runtime. Presumably for trying to map the same file twice. Thank you.
Jan 28 2012
"NewName" <b5353166 nwldx.com> wrote in message news:jg2du7$2nun$1 digitalmars.com...Hello everybody. So I heard that `delete' is being deprecated?When delete is gone, you will still be able to destroy class instances with 'clear' from phobos. Like delete, it runs the destructor on the class, it just doesn't actually free the memory, it leaves it for the gc. When the destructor is called the resources held by MmFile should be released.
Jan 28 2012
Thanks Daniel. So clear() is a function thing, so my delete mmf; will look like clear(mmf); am I right?
Jan 28 2012
Yes. clear is in object.d so it will always be available. "NewName" <b5353166 newldx.com> wrote in message news:jg2fdj$2rmk$1 digitalmars.com...Thanks Daniel. So clear() is a function thing, so my delete mmf; will look like clear(mmf); am I right?
Jan 28 2012