Re: please help with: warning: initialization makes integer from pointer

[ Available lists | Index of freebsd-hackers | Month of Oct 2004 | Week of 8 Oct 2004 | Raw email | View thread | Wrap long lines | Reply | Tag ]
From
Stefan Farfeleder <stefan@fafoe.narf.at>
Date
8 Oct 2004 12:41:22
Subject
Re: please help with: warning: initialization makes integer from pointer
Message-ID
20041008124108.GA59642@wombat.fafoe.narf.at

In reply to
References to

[ Hide this part ]
On Thu, Oct 07, 2004 at 07:43:22PM +0200, Andreas Klemm wrote:
> Dear FreeBSD hackers,
>
> could somebody please help Jonathan, the dspam owner, how to code
> this best under FreeBSD ?

> s->p_getpwnam = (struct passwd) { NULL, NULL, 0, 0, NULL, NULL, NULL };
> ^^^^^^^^^^^^^^^^^^^^ !
> s->p_getpwuid = (struct passwd) { NULL, NULL, 0, 0, NULL, NULL, NULL };
> ^^^^^^^^^^^^^^^^^^^^ !

This works but might cause (harmless) warnings about missing
initialisers:

s->p_getpwnam = (struct passwd) { 0 };
s->p_getpwuid = (struct passwd) { 0 };

Alternatively:

static struct passwd zero_pwd;
s->p_getpwnam = zero_pwd;
s->p_getpwuid = zero_pwd;

Cheers,
Stefan


Elapsed time: 0.172 seconds