Re: Void pointer arithmetic

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux