compiler
compiler copied to clipboard
`__emit addr.u.pri` doesn't work on local arrays.
Issue description:
Minimal complete verifiable example (MCVE):
native printf(const format[], {Float, _}:...);
main()
{
new arr[4];
new addr = __emit(addr.u.pri arr);
printf("%d", addr);
}
Gives an error. It really seems like this should work in the same way as normal locals.
Workspace Information:
- Compiler version:
- Command line arguments provided (or sampctl version):
- Operating System:
Fortunately using arr[0]
does seem to compile to the minimal code:
#pragma option -a
native printf(const format[], {Float, _}:...);
main()
{
new arr[4];
new addr = __emit(addr.u.pri arr[0]);
printf("%d", addr);
}
Gives:
stack fffffffc
addr.pri fffffff0
stor.s.pri ffffffec
It is just a bit awkward.
A duplicate of #677. I'll quote my answer from there, for convenience:
Yes, this is intended behavior. Universal pseudo-opcodes were created with the main purpose of being used in macros and handling the input from users (and by "users" I mean just regular users, not library writers), so their operands are supposed to be single cells.