|
Archives
D Programming
DD.gnu digitalmars.D digitalmars.D.bugs digitalmars.D.dtl digitalmars.D.dwt digitalmars.D.announce digitalmars.D.learn digitalmars.D.debugger C/C++ Programming
c++c++.announce c++.atl c++.beta c++.chat c++.command-line c++.dos c++.dos.16-bits c++.dos.32-bits c++.idde c++.mfc c++.rtl c++.stl c++.stl.hp c++.stl.port c++.stl.sgi c++.stlsoft c++.windows c++.windows.16-bits c++.windows.32-bits c++.wxwindows digitalmars.empire digitalmars.DMDScript |
c++ - Qualification conversions
Hi,
here is another bug (DM allows me to modify const objects without
explicitely casting away the "const" qualifier):
#include <stdio.h>
int main(int argc, char *argv[])
{
const char *a = "Hello world";
char *s;
const char **t = &s; // this conversion shouldn't be allowed
*t = a;
s[0] = ' ';
char **u = &a; // this conversion shouldn't be allowed
(*u)[1] = ' ';
printf("%s\n", a);
return 0;
}
The C++ standard doesn't allow these conversions (see 4.4 Qualification
conversions [conv.qual]), but DM doesn't complain about it.
bye, Christof
--
http://cmeerw.cjb.net JID: cmeerw jabber.at
mailto cmeerw at web.de
...and what have you contributed to the Net?
Dec 29 2001
Thanks! "Christof Meerwald" <cmeerw web.de> wrote in message news:a0ke7d$1oac$1 digitaldaemon.com... Dec 29 2001
|