what is the suggested way to do void * arithmetic ?

Luigi Rizzo rizzo at icir.org
Thu Jul 10 01:19:57 PDT 2003

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 ?


More information about the freebsd-current mailing list