Warning 219 Help
#1

Hello.In my register and login system shows some strange warnings.It`s warning 219.But really I don`t see any problem in lines 270 and 330 here is code from that lines....Warnings are about string."local variable "string" shadows a variable at a preceding level.
pawn Код:
public LoginUser(query[],playerid,AutoLogin,connectionHandle) // line 270

{ // is line 330
Reply
#2

it means you have it somewhere as
pawn Код:
new string[SIZE];
Twice,it could be defined as a global, or a local variable. Just change it where its needed.
Reply
#3

don't use generic names like that for variables. You end up polluting the namespace.

Quote:
Originally Posted by ******
Globals are ALWAYS allocated, no matter how often you use them. Locals have memory allocated on, and freed from, the stack as and when (and if) it's needed. What's more, using locals reduces the number of bugs caused by functions accessing the same variables and "pollutes" the global namespace less, making naming collisions less likely. If you really want to statically allocate all your arrays, use static locals rather than full globals.
Quote:
Originally Posted by ******
Locals are always better than globals (you can increase stack space if you need).
Reply
#4

Quote:
Originally Posted by MP2
Посмотреть сообщение
don't use generic names like that for variables. You end up polluting the namespace.
So I should use local variable for this? Right?
Reply
#5

Quote:
Originally Posted by DobbysGamertag
Посмотреть сообщение
it means you have it somewhere as
pawn Код:
new string[SIZE];
Twice,it could be defined as a global, or a local variable. Just change it where its needed.
I don`t have I try searching but nothing found please help me
Reply
#6

it means you have already use new string so don't use it again find for new string in your script if it is under include but before gamemodeinit or fiterscriptinit so delete it
edit: and see line before 270 which have new string , i think there will be a mistake
Reply
#7

Quote:
Originally Posted by PrinceKumar
Посмотреть сообщение
it means you have already use new string so don't use it again find for new string in your script if it is under include but before gamemodeinit or fiterscriptinit so delete it
edit: and see line before 270 which have new string , i think there will be a mistake
Ohh my god.I have only one global variable for string.Search in my script but I didn`t find any " new string " .Problem is somewhere else...
Reply
#8

then post your codes here to get the solution
Reply
#9

Quote:
Originally Posted by PrinceKumar
Посмотреть сообщение
then post your codes here to get the solution
Check top of topic please.
Reply
#10

"string" is probably defined in one of your includes.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)