Void pointer arithmetic

Michael Eager eager@eagercon.com
Fri May 18 05:29:00 GMT 2007


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.


-- 
Michael Eager	 eager@eagercon.com
1960 Park Blvd., Palo Alto, CA 94306  650-325-8077



More information about the Gcc-help mailing list