December 29, 2001
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?
December 29, 2001
Thanks!

"Christof Meerwald" <cmeerw@web.de> wrote in message news:a0ke7d$1oac$1@digitaldaemon.com...
> 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?