public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Questions about const.
@ 2005-07-19  6:02 Ryan Lortie
  2005-07-19  6:22 ` Ian Lance Taylor
  0 siblings, 1 reply; 2+ messages in thread
From: Ryan Lortie @ 2005-07-19  6:02 UTC (permalink / raw)
  To: gcc-help

[please excuse if this is re-post.  i don't think the first message made
it]

GCC generates some warnings when doing type conversions in places that I
don't believe the warnings are required.  It'd be be cool if someone
could explain it to me.  I have an example program here:

http://manic.desrt.ca/const.c

I'm guessing that, by the C standard, arrays that contain items of
different types are always considered incompatible and since 'char *'
and 'const char *' are different types then 'const char **' and 'char
**' are incompatible pointers.  This just doesn't seem very useful when
one of the base types is always safe to automatically promote to the
other (in this case, char * -> const char *) and there is no chance that
an unnoticed conversion could ever occur in the other direction without
generating another warning/error.


Any feedback at all is appreciated -- many thanks.


Cheers.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-07-19  6:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-19  6:02 Questions about const Ryan Lortie
2005-07-19  6:22 ` Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).