[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SV: source

> * Directory::RemoveFile () throws std::bad_alloc according to its
> exception
> specification, but I'm pretty sure neither that method nor any method
> called by it allocates anything.
> That's only an example - most (if not all) methods in Directory.cpp have
> std::bad_alloc in their exception specification while their
> declarations in
> Directory.h had an throw () (i.e. specified that they throw *nothing*).
Directory::RemoveFile CAN throw an std::bad_alloc exception. If you look in
the implementation, you will find that there are actually several calls it
make than can result in this, notably the DynHashTable constructor and

I didn't find any places where bad_alloc was specified, but it in reality
could not be thrown (you fixed this? Or there was no problem?). I did find
an occurence of the opposite: SetParent() and MakeTopDir() can both throw
bad_alloc, as they call RemoveDir(), but they did not specify bad_alloc as
an exception that might be thrown (is fixed in the source I sent you).

> * DirectoryEntryIterator::Advance () should show the same behavior as
> DirectoryEntryIterator::operator++ (), right? It doesn't. Using it in its
> current implementation is very dangerous.
Where IS that gun!