Joe Buck <[EMAIL PROTECTED]> writes:
| On Thu, Jan 11, 2007 at 02:08:48AM +0100, Gabriel Dos Reis wrote:
| > I'm well aware of the history of "-Winit-self". The issue is more
| > subtile that you would like to make it appear. You would have to study
| > more carefully the threads relating to this issue. If you dig the
| > archive, you should be able to find example of
| >
| > circular_buffer buf = buf;
| >
| > [ or void* p = &p; ]
|
| There isn't really a subtlety; void* p = &p is well-defined, and the same
| is true for other cases where only the address, but not the (undefined)
| value of the initializer is used.
I believe you're interpreting "subtlety" as applying to a different
thing than I intended.
The subtlety I'm refering to is not that "void* p = &p" is not well-defined,
but rather the fact that when we see
T t = some-expression-involving-t;
we would like to warn for cases where there is a high probability that
the *initialization* of "t" *results in undefined behaviour*, as opposed
to leaving "t" undefined. -Wunintialized was not designed to handle
those cases. That matter is compounded by the fact that
some constructs such as
circular_buffer buf = buf;
are well-formed and not attempt to work around agreed deficiency of
-Wunitialized. To do that, it is not clear -- without seeing the body
of the copy constructor -- whether only the address is used or not.
Please, contrast that with the explanation offered earlier:
# It seems to me that the only reason for Winit-self to exists is that
# people try to silence the -Wuninitialized warnings using the init-self
# hack and then other people have to work-around that hack.
| I consider 'int i = i;' a botch that somehow evolved into a promise.
I believe most (all?) people agree on that.
| I'm not going to re-open the war of 2002, but I was never happy with it.
I hope nobody is proposing that.
My initial message was an answer to an inaccuracy in a statement.
-- Gaby