D
d3x0xr
In the other two Postings...
const - and valid conversions of pointers thereto
a more verbose discussion const and conversions
I discussed the existing standards, and discussed several examples of
the various permutations of the declaration of const....
I have been told by several people that my 'interpretation is wrong
about what const it' and that it does not mean what I mean, then
continue to say that it does not force data to remain the same, becuase
aliasing etc can subvert the whole scheme and render any use of const as
mute.
The point I'd really like to see be made is that const should be an
advisory, a declared statement of intent not to modify data. And one
conversion which should always be safe (and not generate a warning) is
any conversion which gains the const attribute at any level.
I'd like to see people be able to declare
void f ( const char * * dont_modify_my_chars )
{
}
and use
{
char buffer[256];
char * buf2 = buffer;
f(&buf2);
}
const - and valid conversions of pointers thereto
a more verbose discussion const and conversions
I discussed the existing standards, and discussed several examples of
the various permutations of the declaration of const....
I have been told by several people that my 'interpretation is wrong
about what const it' and that it does not mean what I mean, then
continue to say that it does not force data to remain the same, becuase
aliasing etc can subvert the whole scheme and render any use of const as
mute.
The point I'd really like to see be made is that const should be an
advisory, a declared statement of intent not to modify data. And one
conversion which should always be safe (and not generate a warning) is
any conversion which gains the const attribute at any level.
I'd like to see people be able to declare
void f ( const char * * dont_modify_my_chars )
{
}
and use
{
char buffer[256];
char * buf2 = buffer;
f(&buf2);
}