Weird. I compiled the code on gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-20) and got:
test.cc: In function `int main(int, char**)':
test.cc:3: warning: `const char*ptr' might be used uninitialized in this
function
test.cc:4: warning: `char*ptr2' might be used uninitialized in this function
Don't have your version installed though, so it may be release-specific. However, my guess is that the compiler has optimized out the const char* ptr reference, and thus does not report it.
Bookmarks