Closing streams on deletion

Max Samukha samukha at voliacable.com
Fri Jan 26 03:00:09 PST 2007


Are streams supposed to get closed when they are deleted? Currently
only file stream seems to work that way (its destructor calls
close()).

scope auto file = new File("file.txt");
// ok. file is closed at the end of the scope

scope auto file = new EndianStream(new BufferedFile("file.txt"));
// I expected the EndianStream's destructor would close the stream and
the underlying stream (nestClose is true) but that didn't happen.

It is by design?
 



More information about the Digitalmars-d-learn mailing list