Odd structure "bug"
a_riot42
AMX Wizard
I noticed the other day that the compiler doesn't care if you declare a structure type without defining it. In define_variable you can put:
and even though there is no _Fubar in define_type, the compiler doesn't care. Rather odd.
Paul
volatile _Fubar fubar
and even though there is no _Fubar in define_type, the compiler doesn't care. Rather odd.
Paul
Comments
-
I talked to Mark Gillner, AMX Canada Trainer, and he figures the compiler will
simply ignore fubar and _Fubar will be an Integer.
volatile _Fubar fubar
compiler interprets to
VOLATILE Integer _Fubar; -
I noticed the other day that the compiler doesn't care if you declare a structure type without defining it. In define_variable you can put:
volatile _Fubar fubar
and even though there is no _Fubar in define_type, the compiler doesn't care. Rather odd.
Paul
There is no structure type involved here.jdonachiue@shaw.ca wrote: »I talked to Mark Gillner, AMX Canada Trainer, and he figures the compiler will
simply ignore fubar and _Fubar will be an Integer.
volatile _Fubar fubar
compiler interprets to
VOLATILE Integer _Fubar;
I don't think that is true.
I think the compiler will see _Fubar as a VOLATILE INTEGER
and
the compiler will see fubar as a NON_VOLATILE INTEGER
Edit:
To further clarifyDEFINE_VARIABLE volatile _Fubar fubar
Will be seen as:DEFINE_VARIABLE volatile _Fubar // defaults to INTEGER fubar // defaults to NON_VOLATILE INTEGER
-
Yes the compiler must see it as an integer. Without the structure in define_type it has no way of knowing you are trying to declare a structure rather than a default integer. I had a typo in my structure declaration and was surprised that the compiler didn't complain, but what you say makes perfect sense.
Paul -
Ah yes, that makes perfect sense.
DEFINE_VARIABLE
volatile _Fubar // defaults to INTEGER
fubar // defaults to NON_VOLATILE INTEGER
Thank you for the clarification.
Categories
- All Categories
- 2.5K AMX General Discussion
- 922 AMX Technical Discussion
- 514 AMX Hardware
- 502 AMX Control Products
- 3 AMX Video Distribution Products
- 9 AMX Networked AV (SVSI) Products
- AMX Workspace & Collaboration Products
- 3.4K AMX Software
- 151 AMX Resource Management Suite Software
- 386 AMX Design Tools
- 2.4K NetLinx Studio
- 135 Duet/Cafe Duet
- 248 NetLinx Modules & Duet Modules
- 57 AMX RPM Forum
- 228 MODPEDIA - The Public Repository of Modules for Everyone
- 943 AMX Specialty Forums
- 2.6K AMXForums Archive
- 2.6K AMXForums Archive Threads
- 1.5K AMX Hardware
- 432 AMX Applications and Solutions
- 249 Residential Forum
- 182 Tips and Tricks
- 146 AMX Website/Forums