switching back to the stricter declaration of |nsDerivedSafe<T>::operator=()|. Since I removed |nsISupportsArray::operator=()|, all should be well. I left the old declaration in but commented out, just in case. I hope I don't have to conditionalize this wth an autoconf test. I've built this (with the help of several other people including mjudge, waqar, slamm, et al) on as many other platforms as I could. This declaration is intended to stop people from declaring an |operator=()| in their (XP)COM interface classes.

git-svn-id: svn://10.0.0.236/trunk@40688 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
scc%netscape.com 1999-07-22 20:03:42 +00:00
parent d35c75250f
commit 547fe93c5a
2 changed files with 32 additions and 4 deletions

View File

@ -195,9 +195,23 @@ class nsDerivedSafe : public T
void operator delete( void*, size_t ); // NOT TO BE IMPLEMENTED
// declaring |operator delete| private makes calling delete on an interface pointer a compile error
nsDerivedSafe<T>& operator=( const nsDerivedSafe<T>& ); // NOT TO BE IMPLEMENTED
// nsDerivedSafe<T>& operator=( const T& ); // NOT TO BE IMPLEMENTED
/*
The new way (not commented-out, below) didn't work until I chopped |operator=()| out of
|nsISupportsArray|. I have tested this on as many platforms as I can, I'm switching it on now.
I'm leaving the old way commented out, but visible so we can switch back if there is any
problem.
*/
// nsDerivedSafe<T>& operator=( const nsDerivedSafe<T>& ); // NOT TO BE IMPLEMENTED
nsDerivedSafe<T>& operator=( const T& ); // NOT TO BE IMPLEMENTED
// you may not call |operator=()| through a dereferenced |nsCOMPtr|, because you'd get the wrong one
/*
Compiler warnings and errors: nsDerivedSafe operator=() hides inherited operator=().
If you see that, that means somebody checked in a (XP)COM interface class that declares an
|operator=()|, and that's _bad_. So bad, in fact, that this declaration exists explicitly
to stop people from doing it.
*/
};
#if !defined(HAVE_CPP_USING) && defined(NEED_CPP_UNUSED_IMPLEMENTATIONS)

View File

@ -195,9 +195,23 @@ class nsDerivedSafe : public T
void operator delete( void*, size_t ); // NOT TO BE IMPLEMENTED
// declaring |operator delete| private makes calling delete on an interface pointer a compile error
nsDerivedSafe<T>& operator=( const nsDerivedSafe<T>& ); // NOT TO BE IMPLEMENTED
// nsDerivedSafe<T>& operator=( const T& ); // NOT TO BE IMPLEMENTED
/*
The new way (not commented-out, below) didn't work until I chopped |operator=()| out of
|nsISupportsArray|. I have tested this on as many platforms as I can, I'm switching it on now.
I'm leaving the old way commented out, but visible so we can switch back if there is any
problem.
*/
// nsDerivedSafe<T>& operator=( const nsDerivedSafe<T>& ); // NOT TO BE IMPLEMENTED
nsDerivedSafe<T>& operator=( const T& ); // NOT TO BE IMPLEMENTED
// you may not call |operator=()| through a dereferenced |nsCOMPtr|, because you'd get the wrong one
/*
Compiler warnings and errors: nsDerivedSafe operator=() hides inherited operator=().
If you see that, that means somebody checked in a (XP)COM interface class that declares an
|operator=()|, and that's _bad_. So bad, in fact, that this declaration exists explicitly
to stop people from doing it.
*/
};
#if !defined(HAVE_CPP_USING) && defined(NEED_CPP_UNUSED_IMPLEMENTATIONS)