Burgershot
  • Home
  • Members
  • Team
  • Help
  • Search
  • Register
  • Login
  • Home
  • Members
  • Help
  • Search
Burgershot SA-MP Pawn Scripting [Pawn] [SOLVED] How to Use Pragma ? From #Pragma tabsize 0

 
  • 0 Vote(s) - 0 Average
Pawn [SOLVED] How to Use Pragma ? From #Pragma tabsize 0
PutuSuhartawan
Offline

Burgershot Member
Posts: 120
Threads: 52
Joined: Nov 2020
Reputation: 1
Location: Indonesia
#1
2021-05-14, 10:12 AM (This post was last modified: 2021-05-15, 05:56 PM by PutuSuhartawan.)
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
Y_Less
Offline

Administrator

Posts: 323
Threads: 16
Joined: Feb 2019
Reputation: 90
#2
2021-05-14, 08:22 PM
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.
Radical
Offline

Burgershot Member
Posts: 148
Threads: 21
Joined: Dec 2020
Reputation: 16
#3
2021-05-14, 08:31 PM
(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
Y_Less
Offline

Administrator

Posts: 323
Threads: 16
Joined: Feb 2019
Reputation: 90
#4
2021-05-14, 09:01 PM
The real question is why are you disabling so many warnings? They are important.
Radical
Offline

Burgershot Member
Posts: 148
Threads: 21
Joined: Dec 2020
Reputation: 16
#5
2021-05-14, 09:59 PM (This post was last modified: 2021-05-14, 10:02 PM by Radical.)
(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
PutuSuhartawan
Offline

Burgershot Member
Posts: 120
Threads: 52
Joined: Nov 2020
Reputation: 1
Location: Indonesia
#6
2021-05-14, 11:35 PM
(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.
Y_Less
Offline

Administrator

Posts: 323
Threads: 16
Joined: Feb 2019
Reputation: 90
#7
2021-05-15, 09:57 AM
(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.
Radical
Offline

Burgershot Member
Posts: 148
Threads: 21
Joined: Dec 2020
Reputation: 16
#8
2021-05-15, 10:56 AM
(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 239: literal array/string passed to a non-const parameter //SetTimer
warning 239: literal array/string passed to a non-const parameter //SetPVarInt
warning 239: literal array/string passed to a non-const parameter //SetPVarFloat
warning 239: literal array/string passed to a non-const parameter //SetPVarString
warning 239: literal array/string passed to a non-const parameter //SetPVarString
warning 239: literal array/string passed to a non-const parameter //ShowPlayerDialog
warning 239: literal array/string passed to a non-const parameter //ShowPlayerDialog
warning 239: literal array/string passed to a non-const parameter //ShowPlayerDialog
warning 239: literal array/string passed to a non-const parameter //ShowPlayerDialog
warning 239: literal array/string passed to a non-const parameter //TextDrawSetString
warning 239: literal array/string passed to a non-const parameter //PlayerTextDrawSetString
warning 239: literal array/string passed to a non-const parameter //ApplyAnimation
warning 239: literal array/string passed to a non-const parameter //ApplyAnimation
warning 239: literal 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
Y_Less
Offline

Administrator

Posts: 323
Threads: 16
Joined: Feb 2019
Reputation: 90
#9
2021-05-15, 02:02 PM
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
PutuSuhartawan
Offline

Burgershot Member
Posts: 120
Threads: 52
Joined: Nov 2020
Reputation: 1
Location: Indonesia
#10
2021-05-15, 05:46 PM
(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.
Pinch
Offline

Burgershot Member
Posts: 391
Threads: 19
Joined: Apr 2019
Reputation: 22
Location: Belgrade, Serbia
#11
2021-05-15, 08:00 PM
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.
Y_Less
Offline

Administrator

Posts: 323
Threads: 16
Joined: Feb 2019
Reputation: 90
#12
2021-05-15, 08:24 PM
How can a regex know which parameter should be `const` and which shouldn't?
Pinch
Offline

Burgershot Member
Posts: 391
Threads: 19
Joined: Apr 2019
Reputation: 22
Location: Belgrade, Serbia
#13
2021-05-16, 09:41 AM
(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.
PutuSuhartawan
Offline

Burgershot Member
Posts: 120
Threads: 52
Joined: Nov 2020
Reputation: 1
Location: Indonesia
#14
2021-05-16, 05:10 PM (This post was last modified: 2021-05-16, 05:13 PM by PutuSuhartawan.)
(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?
Y_Less
Offline

Administrator

Posts: 323
Threads: 16
Joined: Feb 2019
Reputation: 90
#15
2021-05-17, 08:50 AM
(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.
ZyZu.
Offline

Burgershot Member
Posts: 17
Threads: 2
Joined: Apr 2019
Reputation: 0
Location: Canada
#16
2021-06-07, 04:14 AM
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.
« Next Oldest | Next Newest »



  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Burgershot - Powered by our Community and MyBB Original Theme by Emerald

Linear Mode
Threaded Mode