------- Comment #15 from manu at gcc dot gnu dot org 2007-08-20 16:15 ------- (In reply to comment #14) > 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. >
Please, take a look at the example given by Andrew http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33086#c3. I can compile and run a similar example: #include <cstdio> void use(const int *a) { int * b = (int *)a; b[0] = 5; } int main(void) { int i=0; use(&i); printf("%d\n", i); return 0; } Of course, the output is '5' and not '0'. So yes, atoi() seems perfectly able to initialize buf. (or perhaps, I am still confused). -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10138