• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] [SOLVED] How to Use Pragma ? From #Pragma tabsize 0
#1
SOLUTION:

That's probably because the new scripter using the old includes as well. Please get the updated ones here:



https://github.com/pawn-lang/pawn-stdlib



The reason?didn't remove the warning code system is because it really cares?about the learning scripter. A lot of recommendations to make question before?the compiler success. Now sir you can find a solution. As the best developer, the basics are usually based on the strength of the solutions created. And asking for a profit before build a new resolver system.





PROBLEM:



I often see Pragma script designs, but I never had the knowledge to relate to this #pragma system. Is this pragma really from pawn?

i just have source?#pragma warning

This directive comes in two forms:
  • #pragma warning (enable|disable) XXX

    Enable or disable a warning by its number.

    Useful for hiding unwanted warnings that otherwise cannot be fixed.

  • #pragma warning (push|pop)

    Save or restore the list of currently disabled warnings.

    This can be used in conjuction with the previous form to toggle warnings

    for a piece of code:

    #pragma warning push

    #pragma warning disable XXX

    // some code here

    Put Error code after vairable option warning disable, Sample:
    Code:
    #pragma warning disable 239#pragma warning disable 217#pragma warning disable 219#pragma warning disable 203
    Quote:From Radical solution,?You can also:
    Code:
    #pragma warning disable 239, 217, 219, 203
    #pragma warning pophttps://github.com/compuphase/pawn/issues/24
  Reply
#2
What's the question? Most of these are documented in pawn-lang.pdf. `#pragma warning` is in the SA:MP and official compilers, but have different implementations since we forked.
  Reply
#3
(2021-05-14, 10:12 AM)PutuSuhartawan Wrote: SOLUTION:

Put Error code after vairable warning disable, Sample:

Code:
#pragma warning disable 239

#pragma warning disable 217

#pragma warning disable 219

#pragma warning disable 203



You can also:

Code:
#pragma warning disable 239, 217, 219, 203
  Reply
#4
The real question is why are you disabling so many warnings? They are important.
  Reply
#5
(2021-05-14, 09:01 PM)Y_Less Wrote: The real question is why are you disabling so many warnings?? They are important.



It gets a lot of warnings?when using Zeex compiler.

It's a?resaon why I am?disabled some?warnings?even those important.



Warnings:



239: literal array/string passed to a non-const parameter



214: possibly a "const" array
  Reply
#6
(2021-05-14, 09:59 PM)Radical Wrote:
(2021-05-14, 09:01 PM)Y_Less Wrote: The real question is why are you disabling so many warnings?? They are important.



It gets a lot of warnings?when using Zeex compiler.

It's a?resaon why I am?disabled some?warnings?even those important.



Warnings:



239: literal array/string passed to a non-const parameter



214: possibly a "const" array



You are very intelligent. Respect



The reason I didn't display the warning code is because it really annoys the learning scripter. A lot of complaints came out during the compiler. But never realized to find a solution. As the best developer, the basics are usually based on the strength of the solutions created.
  Reply
#7
(2021-05-14, 09:59 PM)Radical Wrote:
(2021-05-14, 09:01 PM)Y_Less Wrote: The real question is why are you disabling so many warnings?? They are important.



It gets a lot of warnings?when using Zeex compiler.

It's a?resaon why I am?disabled some?warnings?even those important.



Warnings:



239: literal array/string passed to a non-const parameter



214: possibly a "const" array



That means your code is bad. Hiding issues doesn't solve them, it just means you're ignoring the bugs. I'm going to delete this topic soon, because you're advocating terrible coding practices. Like most things, we can't stop you doing them, but we can stop you spreading your terrible practices to other people and can help them learn correctly instead.
  Reply
#8
(2021-05-15, 09:57 AM)Y_Less Wrote:
(2021-05-14, 09:59 PM)Radical Wrote:
(2021-05-14, 09:01 PM)Y_Less Wrote: The real question is why are you disabling so many warnings?? They are important.



It gets a lot of warnings?when using Zeex compiler.

It's a?resaon why I am?disabled some?warnings?even those important.



Warnings:



239: literal array/string passed to a non-const parameter



214: possibly a "const" array



That means your code is bad.? Hiding issues doesn't solve them, it just means you're ignoring the bugs.? I'm going to delete this topic soon, because you're advocating terrible coding practices.? Like most things, we can't stop you doing them, but we can stop you spreading your terrible practices to other people and can help them learn correctly instead.



let me tell you before deleting this topic.



If I compile the following codes with Zeex compiler:



Code:
SetTimer("OneSecTimer", 1000, 1);

SetPVarInt(playerid, "Var", int_value);

SetPVarFloat(playerid, "varname", float_value);

SetPVarString(playerid, "varname", "string");

ShowPlayerDialog(playerid, dialogid, style, "Caption", "Info", "Button 1", "Button 2");

TextDrawSetString(globaltextid, "string");

PlayerTextDrawSetString(playerid, playertextid, "string");

ApplyAnimation(playerid, "animlib", "animname", 4.1, 0, 0, 0, 0, 0, 0);

SendRconCommand("hostname name");



I get the following warnings:



PHP Code:
warning 239literal array/string passed to a non-const parameter //SetTimer

warning 239literal array/string passed to a non-const parameter //SetPVarInt

warning 239literal array/string passed to a non-const parameter //SetPVarFloat

warning 239literal array/string passed to a non-const parameter //SetPVarString

warning 239literal array/string passed to a non-const parameter //SetPVarString

warning 239literal array/string passed to a non-const parameter //ShowPlayerDialog

warning 239literal array/string passed to a non-const parameter //ShowPlayerDialog

warning 239literal array/string passed to a non-const parameter //ShowPlayerDialog

warning 239literal array/string passed to a non-const parameter //ShowPlayerDialog

warning 239literal array/string passed to a non-const parameter //TextDrawSetString

warning 239literal array/string passed to a non-const parameter //PlayerTextDrawSetString

warning 239literal array/string passed to a non-const parameter //ApplyAnimation

warning 239literal array/string passed to a non-const parameter //ApplyAnimation

warning 239literal array/string passed to a non-const parameter //SendRconCommand 



Is my code bad?



There was another topic about this - https://burgershot.gg/showthread.php?tid=1556
  Reply
#9
That's probably because you're using the old includes as well. Get the updated ones here:



https://github.com/pawn-lang/pawn-stdlib

https://github.com/pawn-lang/samp-stdlib
  Reply
#10
(2021-05-15, 02:02 PM)Y_Less Wrote: That's probably because you're using the old includes as well.? Get the updated ones here:



https://github.com/pawn-lang/pawn-stdlib



Thanks sir.
  Reply
#11
And use regex to replace non-constants lol
Using Pawn.CMD?

If you're doing so, this is the very first sign that you absolutely shouldn't utilize your all powerful P-Code knowledge in any of the scripting discussion topics.
  Reply
#12
How can a regex know which parameter should be `const` and which shouldn't?
  Reply
#13
(2021-05-15, 08:24 PM)Y_Less Wrote: How can a regex know which parameter should be `const` and which shouldn't?

In most cases (at least for me) it did the job, it's much easier to remove const than add it on thousands of places where it isn't needed..
Using Pawn.CMD?

If you're doing so, this is the very first sign that you absolutely shouldn't utilize your all powerful P-Code knowledge in any of the scripting discussion topics.
  Reply
#14
(2021-05-16, 09:41 AM)Pinch Wrote:
(2021-05-15, 08:24 PM)Y_Less Wrote: How can a regex know which parameter should be `const` and which shouldn't?
In most cases (at least for me) it did the job, it's much easier to remove const than add it on thousands of places where it isn't needed..
How to use??regex? and why regex just better than const sir?
  Reply
#15
(2021-05-16, 09:41 AM)Pinch Wrote:
(2021-05-15, 08:24 PM)Y_Less Wrote: How can a regex know which parameter should be `const` and which shouldn't?

In most cases (at least for me) it did the job, it's much easier to remove const than add it on thousands of places where it isn't needed..



Yeah that's fair.
  Reply
#16
This is a very useful thread, please do not delete. I had the same issue with Zeex's Compiller! Warnings fixed after updating my include files.
  Reply


Forum Jump: