libprimis icon indicating copy to clipboard operation
libprimis copied to clipboard

Refactor macro kludge in command.cpp fxn `executeret`

Open no-lex opened this issue 4 years ago • 0 comments

https://github.com/project-imprimis/imprimis/blob/2f7b46f4fde9e42151d0484f38e71311cffc5149/src/engine/command.cpp#L2881-L2893

This relies on the macro assignment #define callargs being identical to the int callargs assigned in the nominal usage of the macro in https://github.com/project-imprimis/imprimis/blob/2f7b46f4fde9e42151d0484f38e71311cffc5149/src/engine/command.cpp#L2711-L2754

This is bad because it

  • relies on the macro imitating a normal variable
  • has a macro with the same name as a normal variable
  • reinterprets an argument of a macro with another macro to be an unrelated variable
  • reinvents what a function is in the C++ preprocessor
  • is entirely undocumented

This should be replaced with an inline function doing the same thing.

no-lex avatar Mar 22 '20 21:03 no-lex