From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12929 invoked by alias); 18 May 2007 11:01:39 -0000 Received: (qmail 12913 invoked by uid 22791); 18 May 2007 11:01:37 -0000 X-Spam-Check-By: sourceware.org Received: from hera.rbi.informatik.uni-frankfurt.de (HELO hera.rbi.informatik.uni-frankfurt.de) (141.2.1.1) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 18 May 2007 11:01:32 +0000 Received: from [141.2.119.130] (dumbo.ghl40.whgl.uni-frankfurt.de [141.2.119.130]) by hera.rbi.informatik.uni-frankfurt.de (8.13.7/8.13.7) with ESMTP id l4IB1NEl013745; Fri, 18 May 2007 13:01:24 +0200 Subject: Re: Void pointer arithmetic From: Sven Eschenberg To: Michael Eager Cc: gcc-help@gcc.gnu.org In-Reply-To: <464D39CF.6070908@eagercon.com> References: <464CCCD7.1020104@cs.uni-frankfurt.de> <464D39CF.6070908@eagercon.com> Content-Type: text/plain Date: Fri, 18 May 2007 11:01:00 -0000 Message-Id: <1179486081.7313.2.camel@dumbo.ghl40.whgl.uni-frankfurt.de> Mime-Version: 1.0 X-Mailer: Evolution 2.8.3 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2007-05/txt/msg00172.txt.bz2 On Thu, 2007-05-17 at 22:29 -0700, Michael Eager wrote: > Sven Eschenberg wrote: > > Hi list, > > > > Long time ago I wrote a small application, well back when g++ didn't > > even insist on std::cout. Now, since I upgrade g++ and tried to compile > > the application, g++ threw errors and warnings in masses. Most of the > > stuff I could fix, but I am stuck with the following problem: > > > > /usr/include/linux/netfilter_ipv4/ip_tables.h: In function > > 'xt_entry_target* ipt_get_target(ipt_entry*)': > > /usr/include/linux/netfilter_ipv4/ip_tables.h:225: error: pointer of > > type 'void *' used in arithmetic > > /usr/include/linux/netfilter_ipv4/ip_tables.h:225: error: invalid > > conversion from 'void*' to 'xt_entry_target*' > > > > Is there any chance of fixing the problem without tweaking the kernel > > includes (the running kernel is kinda ancient, but updates are a little > > difficult)? > > Cast the (void *) to (char *). > > It's not clear what the type of xt_entry_target is. If it > is a pointer, then there should be no problem converting. > > Well, the funny thing is, the pointer is casted to void *, and then returned, the inline functions return type is a different type anyway, so I changed it to the return type which pretty much does the job. Still, feels uncomfortable, that I had to change the header (which is from a pretty recent kernel headers package). -Sven