Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: new warnings in the new intel compiler

Author: Robert Hyatt

Date: 07:49:26 12/31/02

Go up one level in this thread


On December 31, 2002 at 09:13:15, Uri Blass wrote:

>How do I get rid of this warning?
>
>C:\unzipped\movei257source\main.c(939): warning #181: argument is incompatible
>with corresponding format string conversion
>  num_fields=sscanf(buffer,"level%s %s %s %s %s %s %s %s
>%s",&str1,&str2,&str3,&str4,&str5,&str6,
>
>Is there something wrong with the following?
>
>int num_fields=0;
>char
>str1[10],str2[10],str3[10],str4[10],str5[10],str6[10],str7[10],str8[10],str9[10];
>num_fields=sscanf(buffer,"level%s %s %s %s %s %s %s %s
>%s",&str1,&str2,&str3,&str4,&str5,&str6,
>	   &str7,&str8,&str9);
>



Technically the &str1 is wrong.  str1 is already a pointer, as that is how
C implements arrays.  You are trying to take the address of a pointer and pass
that.  The compiler usually does the right thing, knowing that this is a common
error.

I use sscanf regularly without any warnings although I am not sure I have
tried it with the latest intel C compiler.

Try dumping the &'s in the above first to see if that fixes the problem...



>I use it to read the winboard command after level(can be not more than 9 even in
>the extended level command).
>There were no problems with it but for some reasons the intel compiler see
>problems.
>
>For now there is no speed change from the intel compiler but I still did not
>learn how to do profile optimization and I use only optimize for speed.
>
>Uri



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.