• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] YSI and const correctness warnings from the community compiler
#1
So I've installed the latest version of the pawn compiler and surely enough tons of const correctness warnings started popping up when compiling, most of them from ysi libraries



I took it upon myself to fix most of them, however there is one I don't know how to fix



Here's the compiler warning



Code:
INFO: Compiling C:\Users\nonso\Desktop\WaveLS\gamemodes\crimewave.pwn with compiler version 3.10.9



C:\Users\nonso\Desktop\WaveLS\dependencies\YSI-Includes\YSI_Internal\y_funcinc.inc:112 (warning) literal array/string passed to a non-const parameter



And this is the code the error refers to



Code:
memset("", 0, 0);



inside



Code:
public _@_y_funcinc_@_()

{

? yadda yadda...

}



It seems that the code is calling the memset?function which has a non-const parameter, however because of how vast and complex ysi's libraries are for a novice like me I'm not really sure where to find it and how to fix it



Could anyone help with that? ty
  Reply
#2
Are you using the latest package YSI 5.x?



if you do im also using and no problems on compile time all libraries are correct in there places
  Reply
#3
Yeah that's not how it works. Afaik the latest YSI has and always will be tuned for the new compiler. If you have to edit the library for it it to compile, you're likely doing something wrong.
[Image: uc?export=view&id=1C5dMc9kb09iAUuASWBEPCK21lsedAXmB]

  Reply
#4
(2019-05-04, 06:57 PM)Crayder Wrote: Yeah that's not how it works. Afaik the latest YSI has and always will be tuned for the new compiler. If you have to edit the library for it it to compile, you're likely doing something wrong.



I legit reinstalled YSI through sampctl a few hours ago, idk if sampctl is installing an earlier version
  Reply
#5
Use `@5.x` to get 5.x from sampctl. 4.x isn't const-correct (there is a pull request for some of it, but it still needs some more work).
  Reply
#6
(2019-05-05, 12:23 AM)Y_Less Wrote: Use `@5.x` to get 5.x from sampctl. ?4.x isn't const-correct (there is a pull request for some of it, but it still needs some more work).



Alright man thanks a ton
  Reply
#7
I will add to this ages-old thread with a new problem I am having.



I use the y_commands function "Command_ReProcess" to call commands from the script, as in "to fake commands". This means that when a player does something, I might call the command "/quitrace" for example, to make sure the player's actions don't interfere with the ongoing race they are participating.



I can no longer pass literal strings into this function, as the compiler comes up with warnings. How can I keep using the function like this while keeping the warnings away? Or am I misusing the function in some way?



Another, seemingly obvious (to me) false positive comes from using INI_Load with a pre-determined file - I load my server's saved information from a file with a static filename in the server files, but now by passing a literal string as the filename I get const correctness errors.



Any ideas to fix this?
  Reply


Forum Jump: