winegcc atof() bug?

Benjamin Fabricius benjamin.fabricius at lawo.de
Thu Jun 29 05:15:21 CDT 2006


Hi,

Im experiencing weird things when using atof() in certain places of my
software and compiling with winegcc (wine20050725).

It works fine when calling it out of the main function but as soon as i
migrated some routines to another c file things became really strange.

atoi works fine but as soon as i use atof with any "x.x" string i keep
on getting some negative constant value as it seems. thought this might
be HUGE_VAL of strtod but atof doesnt return any errors..

Anybody experience similar problems. unfortunately i am dependent on
this wine version.. so changing wine versions won't help since current
builds interfere with other parts of the software running in wine.

Heres a really simple example code of what im trying to do:

--- snip ---

void print_set_parameters(char **setparams, int startofparams, int
endofparams)
{	
	
	int param_num;
	double param_value;
	
	/* this works fine setparams has got the right
	 * string values
	 */
	printf("test %d\n", startofparams);
	printf("test %s\n", setparams[3]);
	printf("test %s\n", setparams[4]);
	
	for(i = startofparams; i < endofparams; i++)
	{		
		// works fine!
		param_num = atoi(setparams[i]);
		printf("string is %s, param number %d\n",   setparams[i],param_num);
		i++;
		
		// heres where the trouble starts
		param_value = atof(setparams[i]);
		// tried this as an alternative same problem
		// param_value = strtod(".1", 0);		
		// no errors reported
		// perror(__FUNCTION__);
		printf("param value %f\n", param_value);
	}
}


--- snip ---

Any help would be great!!

Cheers,
..Ben


-- 
-------------------
Benjamin Fabricius
German Student
Lawo AG




More information about the wine-devel mailing list