Why I get those warning? :S
#9

Quote:
Originally Posted by KosmasRego
Посмотреть сообщение
When I putted #include <YSI> it shows those errors:

C:\Users\KosmasRego\Desktop\UCRP 1.1.250\pawno\include\YSI\y_utils.inc(160) : warning 219: local variable "str" shadows a variable at a preceding level
C:\Users\KosmasRego\Desktop\UCRP 1.1.250\pawno\include\YSI\y_utils.inc(263) : warning 219: local variable "str" shadows a variable at a preceding level
C:\Users\KosmasRego\Desktop\UCRP 1.1.250\pawno\include\YSI\y_utils.inc(289) : warning 219: local variable "str" shadows a variable at a preceding level
C:\Users\KosmasRego\Desktop\UCRP 1.1.250\pawno\include\YSI\y_debug.inc(231) : warning 219: local variable "str" shadows a variable at a preceding level
C:\Users\KosmasRego\Desktop\UCRP 1.1.250\pawno\include\YSI\y_debug.inc(291) : warning 219: local variable "str" shadows a variable at a preceding level
C:\Users\KosmasRego\Desktop\UCRP 1.1.250\pawno\include\YSI\y_debug.inc(296) : warning 219: local variable "str" shadows a variable at a preceding level
C:\Users\KosmasRego\Desktop\UCRP 1.1.250\pawno\include\YSI\y_ini.inc(804) : warning 219: local variable "str" shadows a variable at a preceding level


pawn Код:
new levels,Nam[MAX_PLAYER_NAME],pname[MAX_PLAYER_NAME],str[126],ID;
Ok, I'm going to teach you (all) how to read warnings.

This is a warning:
Quote:

C:\Users\KosmasRego\Desktop\UCRP 1.1.250\pawno\include\YSI\y_utils.inc(160) : warning 219: local variable "str" shadows a variable at a preceding level

The first part with the directory can be ignored, as it is of no value in fixing the warning. What is interesting, however, is this: (The bold part)
Quote:

C:\Users\KosmasRego\Desktop\UCRP 1.1.250\pawno\include\YSI\y_utils.inc(160) : warning 219: local variable "str" shadows a variable at a preceding level

This indicates that the warning itself is not in your script, but in an include you downloaded.

Now let's read the actual warning.
Quote:

warning 219: local variable "str" shadows a variable at a preceding level

The warning indicates that a local variable shadows another variable further in the script.
Local means that the vairable is defined within a function.

This is a local variable:
pawn Код:
OnPlayerConnect(playerid)
{
   new something;
The opposite of a local variable is a global variable, a variable that is defined outside of a function, which can be called from anywhere in the script.
Example:
pawn Код:
new something;

OnPlayerConnect(playerid)
{
But, let's continue. If a variable is shadowing another variable, it means that it is defining a variable which is already defined. A simple example of this would be:
pawn Код:
OnPlayerConnect(playerid){
   new something;
   //some random lines
   new something;
   return 1;
}
The variable is defined twice, which causes the warning.


In your case, I think you've defined "str" somewhere in your own script. You can fix the warning by opening your script, look for something along the lines of "new str;" or "new str[some number here];", and change "str" into something else.
(Don't forget to change "str" everwhere else in your script as well.)
Reply


Messages In This Thread
Why I get those warning? :S - by KosmasRego - 21.11.2011, 12:33
Re: Why I get those warning? :S - by THE_KNOWN - 21.11.2011, 12:37
Re: Why I get those warning? :S - by Richie - 21.11.2011, 12:38
Re: Why I get those warning? :S - by KosmasRego - 21.11.2011, 12:40
Re: Why I get those warning? :S - by sleepysnowflake - 21.11.2011, 12:44
Re: Why I get those warning? :S - by KosmasRego - 21.11.2011, 12:46
Re: Why I get those warning? :S - by AndreT - 21.11.2011, 12:46
Re: Why I get those warning? :S - by KosmasRego - 21.11.2011, 12:54
Re: Why I get those warning? :S - by Infinity - 21.11.2011, 12:54
Re: Why I get those warning? :S - by AndreT - 21.11.2011, 12:57

Forum Jump:


Users browsing this thread: 2 Guest(s)