If one of the two values is a string literal and the other is a
non-array, the symbol associated with the first one will be NULL.
But the code checked if sym->name!=NULL rather than sym!=NULL,
hence the crash.
--------- test code --------
main() {
new a, b;
return (a != 0 ? b : "string");
}
----- end of test code -----
When applied to a function #pragma naked merely disables the "should return
a value" warning for the function. It's intended to be used with functions
that return a value via #emit instead of the normal return statement.
This pragma works only on function definitions, not declarations. It's also
pretty stupid - the function may be defined way after this directive and it
won't stop on things coming in between.
For example, here all declarations between #pragma naked and f() are
effectively ignored:
#pragma naked
new x; // ignored
forward g(); // ignored
native n(); // ignored
f() {
// f() becomes naked
}
Note that #pragma naked does not affect generated code in any way, unlike
e.g. __declspec(naked) or __attribute__((naked)) in C/C++ where the compiler
omits the code for the prolog and epilog.
This fixes a crash that occurs if a global variable is initialized
with the result of a function call.
See 3) here: http://forum.sa-mp.com/showthread.php?t=355877
--------- test code --------
native use(...);
f() {
return 0;
}
new x = f();
main() {
use(x);
}
----- end of test code -----