Re: building with gcc 4.4
Milos Jakubicek <[email protected]> Sun, 19 Apr 2009 11:40:45 +0200
| Newsgroups | gmane.mail.cone |
|---|---|
| Message-ID | <[email protected]> |
Hi Sam, Sam Varshavchik wrote: > Milos Jakubicek writes: > >> Hi all, >> >> I'm attaching a tiny patch to make cone building with gcc 4.4, please >> merge it. > > Although this looks very straightforward, I do have some questions. > AFAIK, SUSv2 explicitly defines strchr as taking a const char * arg. The > cast should not be necessary. Yes, the problem is that starting with gcc 4.4, if strchr takes const char*, it also returns const char*, therefore the cast. See http://gcc.gnu.org/gcc-4.4/porting_to.html Additionally, [conv.ptr] of the C++ > standard clearly allows conversion of any pointer type to a void > pointer. That might be -- I'm not a gcc developer, I don't know how much gcc keeps to the standards. I can only say that without the change the build fails, that's all. Furthermore, a quick search of the code finds several other > instances where both strchr() and memcpy() are used with the same > parameter types, so if these two instances need this kind of a patch, > how come the other instances don't? What places, aren't they in an #ifdef so that they do not evaluate? Remember that the problem is again the same: you give const char* to strchr => it returns const char*. I'm not sure whether the standard says you can cast any pointer type, even const type, to void*. Regards, Milos ------------------------------------------------------------------------------ Stay on top of everything new and different, both inside and around Java (TM) technology - register by April 22, and save $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco. 300 plus technical and hands-on sessions. Register today. Use priority code J9JMT32. http://p.sf.net/sfu/p _______________________________________________ Courier-cone mailing list [email protected] Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-cone