From owner-freebsd-hackers@FreeBSD.ORG Fri Oct 8 15:29:06 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C9E0416A4CE for ; Fri, 8 Oct 2004 15:29:06 +0000 (GMT) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7A15D43D45 for ; Fri, 8 Oct 2004 15:29:06 +0000 (GMT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.12.11/8.12.11) id i98FT5qM055134; Fri, 8 Oct 2004 10:29:05 -0500 (CDT) (envelope-from dan) Date: Fri, 8 Oct 2004 10:29:05 -0500 From: Dan Nelson To: Andreas Klemm Message-ID: <20041008152905.GA3106@dan.emsphone.com> References: <20041005054213.GA11770@lesanti.hq.sinectis.com.ar> <416234B1.8020406@nuclearelephant.com> <20041005202816.GA14973@titan.klemm.apsfilter.org> <20041005205040.GH31397@lesanti.hq.sinectis.com.ar> <20041006060437.GA23364@titan.klemm.apsfilter.org> <20041006144220.GA29653@lesanti.hq.sinectis.com.ar> <20041007111139.GA16296@titan.klemm.apsfilter.org> <416579E1.8050308@nuclearelephant.com> <20041007174322.GB3414@titan.klemm.apsfilter.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20041007174322.GB3414@titan.klemm.apsfilter.org> X-OS: FreeBSD 5.3-BETA7 X-message-flag: Outlook Error User-Agent: Mutt/1.5.6i cc: hackers@freebsd.org cc: "Jonathan A. Zdziarski" Subject: Re: please help with: warning: initialization makes integer from pointer X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Oct 2004 15:29:06 -0000 In the last episode (Oct 07), Andreas Klemm said: > Dear FreeBSD hackers, > > could somebody please help Jonathan, the dspam owner, how to code > this best under FreeBSD ? > > Please see his question below: > > On Thu, Oct 07, 2004 at 01:16:17PM -0400, Jonathan A. Zdziarski wrote: > > I'm a little concerned about these warnings: > > > > pgsql_drv.c:873: warning: initialization makes integer from pointer without a cast > > pgsql_drv.c:874: warning: initialization makes integer from pointer without a cast > > > > This could cause some problems with dspam. Is there a freeBSDish way to > > do this: > > > > s->p_getpwnam = (struct passwd) { NULL, NULL, 0, 0, NULL, NULL, NULL }; > > s->p_getpwuid = (struct passwd) { NULL, NULL, 0, 0, NULL, NULL, NULL }; > > > > Perhaps memset(s->p_getpwnam, 0, sizeof(struct passwd)) ? Yes, memset would be much more portable. I don't think there is any standard that says how many fields struct passwd has, or if they must be in any order. POSIX names only 5 required fields and no order. You could use designated initialization, but that's a C99 feature, and since you're initializing everything to zero anyway, memset is still better. -- Dan Nelson dnelson@allantgroup.com