------- Comment #14 from bangerth at dealii dot org 2007-08-20 15:54 ------- (In reply to comment #12)
> This testcase has nothing to do with uninitialized variables. No, of course. I only meant to reply to your assertion that there could be cases where a function initializes an object that is passed as a const pointer. That may work in C, but not in C++. I agree that my example may have been confusing, so take this slight variant of it ('a' is here non-const and uninitialized): ------------------- char a[3]; int main () { return atoi (a); } ------------------- It is my understanding that C++ allows 'a' to be put into read-only memory because the only access is read-only. What that means is that functions like atoi that take constant arguments have no legitimate way to initialize the objects they get, and every uninitialized object passed to them is necessarily a source of bugs. This is meant to only counter your point that: > 'const' does not mean read-only in C++ at all, and much less in C. atoi(const > char *) could always initialize buf[]. This simply isn't true. In C++, atoi can't do that. W. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10138