Re: [OT] gcc-warning: more info
see below
Erdmut Pfeifer wrote:
>
> On Wed, Oct 18, 2000 at 11:08:23AM +0200, Daniel Reuter wrote:
> > Hello there,
> >
> > Thanks to all, who responded up to now. I think I'll give some more
> > information, as I still don't understand, why the warning
> > main.c:158: assignment makes pointer from integer without a cast
> > is generated in my case:
> >
> > I have the following (among some other function and structure
> > declarations) in my program-header-file 'bet.h':
> >
> > #include <stdlib.h>
> > #include <stdio.h>
> >
> > struct provided_data{
> > double sample_weight;
> > struct datapoint *ppovolads;
> > int value_count;
> > };
> >
> > struct provided_data *read_data(char *);
> >
> >
> > This function is in file 'scanner.c' and does the following:
> >
> > #include "bet.h"
> >
> > struct provided_data *read_data(char *input_file_name)
> > {
> > struct provided_data *prov_data_buffer;
> >
> > Read in some data and put them into structure provided_data.
> > Then return pointer to structure provided data using the
> > following statement:
> >
> > return(prov_data_buffer);
> > }
> >
> >
> > In file main.c I have the following:
> >
> > #include "bet.h"
> >
> > int main(int argc, char **argv)
> > {
> > some code that reads commandline opts and so on.
> >
> > Here I define input_data:
> > struct provided_data *input_data;
> >
> > Now call read_data:
> > ---> input_data=read_data(input_file_name);
try:
input_data=(struct provided_data *)read_data(input_file_name);
then try:
input_data=read_data((char *)input_file_name);
and finally:
input_data=(struct provided_data *)read_data((char*)input_file_name);
to figure out which one is the offending integer - it is either return
value (no warning when first line used) or parameter (second line) or
both (third line)... [of course, you can use all three lines at once, no
need to edit/compile for each of them]
are you sure that the struct provided_data is known?
try to simplify the code fragment and compile it alone... [without the
rest of you app]
erik
> > }
> >
> > line marked with ---> is the line, the compiler complains about.
> > I don't quite understand this, because I never declared function read_data
> > to return an int. Is something wrong with my function declaration?
>
> sorry, I can't tell you what the problem is -- doesn't seem to be
> in the syntax. My gcc (egcs-2.91.66) doesn't have any problems with
> this code fragment.
>
> --
> Erdmut Pfeifer
> science+computing gmbh
>
> -- Bugs come in through open windows. Keep Windows shut! --
>
> --
> Unsubscribe? mail -s unsubscribe debian-user-request@lists.debian.org < /dev/null
Reply to: