Thread View: gnu.gcc.bug
1 messages
1 total messages
Started by Winfried Koenig
Tue, 29 Dec 1992 22:32
gcc and g++ warnings
Author: Winfried Koenig
Date: Tue, 29 Dec 1992 22:32
Date: Tue, 29 Dec 1992 22:32
82 lines
2858 bytes
2858 bytes
Hello,
when I compile the enclosed program with gcc (2.3.3) I get warning
messages. The essential message parts are enclosed in the comment.
I think, that messages marked with '!!' are ok but I don't understand
the reason for messages marked with '??'. Some messages are marked
with '!?', I think they should better read: '... discards `const' from ...'.
When I compile the same program with g++ I get no '??' message but
there is also no message for the lines marked with '???'.
Any comments?
Winfried
----------------------- cut ----------------
char ar[] = "foobar";
const char *st = "blub";
const char *const cpc = "wau";
int
main ()
{
char *p;
const char *pc;
char **pp;
const char **ppc;
const char *const *pcpc;
const char *const *const cpcpc = &cpc;
void xpp (char **);
void xppc (const char **);
void xpcpc (const char *const *);
p = ar;
p = st; /* !! assignment discards `const' from pointer target type */
pc = ar;
pc = st;
pp = &p;
pp = &pc; /* !? assignment from incompatible pointer type */
/* ??? no error if compiled with g++ !!!! */
pp = &cpc; /* !? assignment from incompatible pointer type */
ppc = &p; /* ?? assignment from incompatible pointer type */
ppc = &pc;
ppc = &cpc; /* !! assignment discards `const' from pointer target type */
pcpc = &p; /* ?? assignment from incompatible pointer type */
pcpc = &pc;
pcpc = &cpc;
cpcpc = &p; /* !! assignment of read-only variable `cpcpc' */
/* !? assignment from incompatible pointer type */
cpcpc = &pc; /* !! assignment of read-only variable `cpcpc' */
xpp (pp);
xpp (ppc); /* !? arg of `xpp' from incompatible pointer type */
/* ??? no error if compiled with g++ !!!! */
xpp (pcpc); /* !? arg of `xpp' from incompatible pointer type */
xpp (cpcpc); /* !? arg of `xpp' from incompatible pointer type */
xppc (pp); /* ?? arg .. from incompatible pointer type */
xppc (ppc);
xppc (pcpc); /* !! arg .. discards `const' from pointer target type */
xppc (cpcpc); /* !! arg .. discards `const' from pointer target type */
xpcpc (pp); /* ?? arg .. from incompatible pointer type */
xpcpc (ppc);
xpcpc (pcpc);
xpcpc (cpcpc);
return 0;
}
----------------------- cut ----------------
--
Winfried Koenig win@in.rhein-main.de
Arendsstrasse 12 win@in.sub.org
6050 Offenbach +49 69 868707
Germany
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads