This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: warning: initialization makes integer from pointer without a cast
- From: "Rajath N R" <rajathnr at gmail dot com>
- To: "Mike Stump" <mrs at apple dot com>
- Cc: "Jack Howarth" <howarth at bromo dot msbb dot uc dot edu>, gcc at gcc dot gnu dot org
- Date: Sat, 1 Apr 2006 18:58:10 +0530
- Subject: Re: warning: initialization makes integer from pointer without a cast
- References: <20060328214109.C6C5911003E@bromo.msbb.uc.edu> <33AE9ABD-F574-4088-884A-E8E93214BD53@apple.com>
On 3/29/06, Mike Stump <mrs@apple.com> wrote:
> On Mar 28, 2006, at 1:41 PM, Jack Howarth wrote:
> > I do have one other issue to resolve in this legacy c code which I
> > am unclear on.
>
> Wrong list. This list is for the development of gcc, not other
> software.
>
> > warning: initialization makes integer from pointer without a cast
>
> Yup.
>
> > ...for the line with a NULL. My immediate inclination was to
> > substitute '0' for the NULL which does indeed eliminate the
> > warning.
>
> Ick.
>
> > Is there a more appropriate fix?
>
> int i = NULL;
>
> should be written as:
>
> int i = 0;
>
> but, I don't know why that wasn't obvious.
>
for this prepstruct bound_description {
int type;
WORD descr;
} bnddescr[] = {
BNDTYP_NULL, "null",
BNDTYP_BOND, "bond",
BNDTYP_ANGLE, "angle",
BNDTYP_FIXED, "fixed",
BNDTYP_DIHED, "dihed",
BNDTYP_CTLIM, "ctlim",
BNDTYP_BOUND, "bound",
BNDTYP_DIST, "dist",
BNDTYP_EXP, "exp",
BNDTYP_OTHER, "other",
BNDTYP_TRIANGLE,"triang",
NULL
};
for this processor replace NULL by (void *)0 this is out put of preprocessor
struct bound_description {
int type;
char * descr;
} bnddescr[] = {
1, "null",
2, "bond",
3, "angle",
3, "fixed",
4, "dihed",
5, "ctlim",
6, "bound",
7, "dist",
8, "exp",
9, "other",
10, "triang",
((void *)0)
};
there is type mismatch while assign srtuct ...
if u replace NULL by, '0' ascii value of '0' is assign to first
element of struct ....
Regards
Rajath.N.R