-
-
Notifications
You must be signed in to change notification settings - Fork 203
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
Critical bug in Enum + Float array usage #1074
Comments
Compile your code and then decompile it via https://headlinedev.xyz/lysis/
|
amxx uses natives for float calculations. enum broke it somehow (X_AXIS is non-tagged so VecF[X_AXIS] interpreted as int value), and you got wrong result
|
Enums have very weird interactions with arrays. Try removing the tag (eg _:X_AXIS). Or, use enum structs. |
True, and that's what I'm going to do for now, But I think a warning from the compiler about such a behavior would be great, I thought I had a bug in my code and kept rewirting stuff till I figured out it was an issue with enums. |
I'll happily review a patch to add that warning/error. The enum/array code is very, very quirky though. I would not be able to write it off the top of my head. (And probably not off the bottom, either.) |
@justgo97 also you can replace
by
now X_AXIS is tagged as Float so you will get proper behavior
|
I'm using latest AMXX version and by chance I stumbled across this weird behavior with using enums with Float arrays causing werid outputs, can anyone elaborate on what's happening in this code:
Server output:
As you can see altering the variable with the help of the enum gives a garbage value, but with define everything works perfect, can the compiler throw a warning for such a case at least?
The text was updated successfully, but these errors were encountered: