[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [OT] gcc-warning: more info



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);
> 	}
> 
> 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! --



Reply to: