Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow negative numbers in #emit & changes to public variable behaviour #128

Merged
merged 5 commits into from
Jan 17, 2017
Merged

allow negative numbers in #emit & changes to public variable behaviour #128

merged 5 commits into from
Jan 17, 2017

Conversation

YashasSamaga
Copy link
Member

@YashasSamaga YashasSamaga commented Dec 26, 2016

allows negative numbers in #emit

fix for #125

1. 'stock' public (or public const) variables will be written to the file IF AND ONLY IF it has been used (read or write)
2. 'non-stock' public (or public const) variables will always be written to the file (whether or not it has been used)
3. public variables (or public const) NEVER ever trigger unused symbol warnings
stops unused warnings from being triggered for public variables
@YashasSamaga YashasSamaga changed the title allow negative numbers in #emit allow negative numbers in #emit & changes to public variable behaviour Dec 26, 2016
@VVWVV
Copy link
Contributor

VVWVV commented Jan 11, 2017

Yes, you are allow to use negative numbers in #emit, but this is only for integer numbers, not floating.
For example, I did this: VVWVV@880fd10

@YashasSamaga
Copy link
Member Author

YashasSamaga commented Jan 11, 2017

I don't think someone will ever need to pass a rational value to an assembly instruction.

I am not sure how the compiler stores floating point values but amx_ctof seems to do a simple direct cast...

#define amx_ftoc(f)   ( * ((cell*)&f) )   /* float to cell */
#define amx_ctof(c)   ( * ((float*)&c) )  /* cell to float */

so what you did there (OR operation) should be correct.

@Y-Less
Copy link
Member

Y-Less commented Jan 11, 2017

I guess they would if they wanted to do:

#emit PUSH.C 0.5
#emit PUSH.C 7.7
#emit PUSH.C 8
#emit SYSREQ.C floatmul

But that seems more likely to cause confusion and mistakes since there is no tag checking so a stray . won't be flagged and will vastly alter the result.

@Zeex
Copy link
Contributor

Zeex commented Jan 14, 2017

@YashasSamaga Mind fixing Appveyor build and indentation?

Abiding by the C89 declaration rules so that AppVeyor build can succeed.
@YashasSamaga
Copy link
Member Author

  1. AppVeyor requires the code to abide by the C89 declaration rules. Moved the s2 declaration to the start of the block.

  2. Indentation Fixed. I have a doubt with the indentation for line 755 in sc6 ('else'). I am not sure how you prefer to indent else with single statement. You can edit it.

@Zeex Zeex merged commit b13928c into pawn-lang:master Jan 17, 2017
Zeex added a commit that referenced this pull request Jan 17, 2017
@Zeex
Copy link
Contributor

Zeex commented Jan 17, 2017

Great, thanks.

Yes, Visual Studio / MSVC doesn't support C99, and in fact the whole codebase is written in C89, so I try to stick to it too for consistency (I think it was originally done for maximum portability).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants