Const Correctness with Pawno Compiler version 3.10.10
#1

https://github.com/pawn-lang/compile...st-Correctness

After updating my Compiler version to 3.10.10 I have read the Wiki and the Const-Correctness Page...

Unfortunately for me, I haven't really learned about Const's and their usage.

Update, I found my Const's to add to the natives inside the Includes used, including the SAMP original Includes, I modified them to suit my use, probably would be best for someone who really knows what they are doing... to update these for the compiler.

Has anyone got some Info and or a link to a Tutorial about Consts? I still want to learn, if theres really detailed Documentation id love to read it.
Reply
#2

Code:
preLoadAnim(playerid, const animlib[]) return ApplyAnimation(playerid,animlib,"null", 0.0, 0, 0, 0, 0, 0 );
should be
Code:
preLoadAnim(playerid, const animlib[]) return ApplyAnimation(playerid,animlib,"null", 0.0, 0, 0, 0, 0, 0 );
More information: https://github.com/pawn-lang/compile...st-Correctness
Reply
#3

Quote:
Originally Posted by PatrickGTR
View Post
Code:
preLoadAnim(playerid, const animlib[]) return ApplyAnimation(playerid,animlib,"null", 0.0, 0, 0, 0, 0, 0 );
should be
Code:
preLoadAnim(playerid, const animlib[]) return ApplyAnimation(playerid,animlib,"null", 0.0, 0, 0, 0, 0, 0 );
More information: https://github.com/pawn-lang/compile...st-Correctness
Exactly my thoughts, but when I put that in there, I get this

Code:
error 035: argument type mismatch (argument 2)
Not to mention animlib isnt a constant unchanged value, in theory the const should be "null", 0.0, 0, 0, 0, 0, 0
Reply
#4

Double Post Reason: Unresolved, need answers.

Sorry for this double post but I wouldn't do it without a reason, I really want the latest Pawn Compiler, I want to be able to code better, but without the correct knowledge or Tutorials on Const's I don't think it's possible, so for anyone else who's having problems... at this stage, Pawn compiler 3.10.8 seems to run without them warnings. so ive downgraded till it's possible to figure out consts.
Reply
#5

Quote:
Originally Posted by SkyFlare
View Post
Double Post Reason: Unresolved, need answers.

Sorry for this double post but I wouldn't do it without a reason, I really want the latest Pawn Compiler, I want to be able to code better, but without the correct knowledge or Tutorials on Const's I don't think it's possible, so for anyone else who's having problems... at this stage, Pawn compiler 3.10.8 seems to run without them warnings. so ive downgraded till it's possible to figure out consts.
You might want to disable the warning until you figure it out,so that you can still use other features and get bug fixes
Reply
#6

Quote:
Originally Posted by Fairuz
View Post
You might want to disable the warning until you figure it out,so that you can still use other features and get bug fixes
It's okay, I have been running the stock standard Pawno Compiler the whole time I have Scripted for SAMP Servers, all these years, so I guess going down 1 Version wont hurt me, considering its still a very large change anyway.
Reply
#7

PHP Code:
preLoadAnim(playerid, const animlib[]) return ApplyAnimation(playeridanimlib"null"0.000000);
PreloadAnims(playerid)
{
    
preLoadAnim(playerid,"DANCING");

i have just compiled it like this, without "const" it gave me the warns, but after adding it, it worked so fine so good...
zeex 3.10.10.
Reply
#8

Your issue is likely to come from the ApplyAnimation native call, rather than the preLoadAnimLib pawn function.

If you indented the code into at least two lines you could have noticed that the warning line is not the function header. The reason is the native definitions are not const correct in the original includes.
Reply
#9

Quote:
Originally Posted by NaS
View Post
Your issue is likely to come from the ApplyAnimation native call, rather than the preLoadAnimLib pawn function.

If you indented the code into at least two lines you could have noticed that the warning line is not the function header. The reason is the native definitions are not const correct in the original includes.
Yeah, also getting warnings from other Includes too, I am guessing I have to correct the natives for all of these.
Reply
#10

Quote:
Originally Posted by SkyFlare
View Post
Yeah, also getting warnings from other Includes too, I am guessing I have to correct the natives for all of these.
or just backup first and then update them with the latest ones.
Reply
#11

A lot of includes weren't written using this compiler so there's going to be minimal compatibility, especially with older plugins. Changing the natives to include const may mess up compatibility with the plugin, too, if the plugin is built specifically not to use const strings.

EDIT:
Alternatively,
pawn Code:
#pragma warning disable 239
Reply
#12

Quote:
Originally Posted by NaS
View Post
Your issue is likely to come from the ApplyAnimation native call, rather than the preLoadAnimLib pawn function.

If you indented the code into at least two lines you could have noticed that the warning line is not the function header. The reason is the native definitions are not const correct in the original includes.
+REP thanks for the heads up on the Natives, I modified them all where needed and ill continue to do so if more pop up
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)