Hi
> Well it is C++ but new and delete use malloc and free internally
> anyway.
No, no, no!!!!! With MSVC they do, but that is no excuse for not using
new and delete! malloc and free aren't really C++ and certainly not
modern C++. Do not use them in a C++ program without very good reason.
> And wcstombs and LibraryFuncCall are C functions so they cannot >
> throw exceptions.
Fair comment. However, how do you know what they might be replaced with
in the future? Using a smart pointer is good practice. Nobody here
explicitly uses the delete key word (or free for that matter)!
> I like boost but as an exercise I'm trying to do this
> using ATL/WTL/Win32 as much as possible
Ok, try this instead then:
template< class T >
class ArrayPtr
{
private:
T ptr_;
public:
ArrayPtr( T* ptr )
: ptr_(ptr)
{
}
~ArrayPtr()
{
delete[] ptr_;
}
T Ptr()
{
return ptr_;
}
private:
ArrayPtr& operator=( const ArrayPtr& );
ArrayPtr( const ArrayPtr& );
};
> (for example, I also choose MSXML
> through COM over using XercesC, although I have plenty of experience
> with Xerces and none with msxml). I'm just saying that for this
> project I'm trying to go all the way Microsoft so that I can decide
> later on whether I liked it or not.
Fine, that still doesn't prevent you using C++ and preventing memory
leaks.
> It has advantages of course - documentation
> is all in the same place, it's all installed when you install Visual
> Studio, ...
That's just laziness. ;-)
Regards
Paul
Paul Grenyer
Email: [EMAIL PROTECTED]
Web: http://www.paulgrenyer.co.uk
Have you met Aeryn: http://www.paulgrenyer.co.uk/aeryn/?
Version 0.3.0 beta now available for download.