what is the suggested way to do void * arithmetic ?

From: Luigi Rizzo <rizzo_at_icir.org>
Date: Thu, 10 Jul 2003 01:19:56 -0700
Hi,
in several places in ipfw2.c i have to move pointers across
structures of variable length (lists of ipfw2 instructions
returned by the getsockopt()), and i use the following type of code:

	void *next;
	foo *p;

	...

	next = (void *)p + len;
	...
	foo = (foo *)p + len;

When using WARNS=5, the compiler in -current flags them with 'Warning
void * arithmetic'.

What is the best way to do the above given that i do need to use
these variable-size structures ?

	cheers
	luigi
Received on Wed Jul 09 2003 - 23:19:57 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:14 UTC