From owner-freebsd-current@FreeBSD.ORG Thu Jul 10 01:19:57 2003 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9A6CC37B401 for ; Thu, 10 Jul 2003 01:19:57 -0700 (PDT) Received: from xorpc.icir.org (xorpc.icir.org [192.150.187.68]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2485843FBD for ; Thu, 10 Jul 2003 01:19:57 -0700 (PDT) (envelope-from rizzo@xorpc.icir.org) Received: from xorpc.icir.org (localhost [127.0.0.1]) by xorpc.icir.org (8.12.8p1/8.12.3) with ESMTP id h6A8JukN071416; Thu, 10 Jul 2003 01:19:56 -0700 (PDT) (envelope-from rizzo@xorpc.icir.org) Received: (from rizzo@localhost) by xorpc.icir.org (8.12.8p1/8.12.3/Submit) id h6A8JuBY071415; Thu, 10 Jul 2003 01:19:56 -0700 (PDT) (envelope-from rizzo) Date: Thu, 10 Jul 2003 01:19:56 -0700 From: Luigi Rizzo To: current@freebsd.org Message-ID: <20030710011956.A61125@xorpc.icir.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i Subject: what is the suggested way to do void * arithmetic ? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Jul 2003 08:19:57 -0000 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