in reply to Re: XS debugging "failed to extend arg stack"
in thread [Solved] XS debugging "failed to extend arg stack"

Wow, thanks! A good reminder to not use expressions inside macros. And I'll get the metadata fixed too.
  • Comment on Re^2: XS debugging "failed to extend arg stack"

Replies are listed 'Best First'.
Re^3: XS debugging "failed to extend arg stack"
by khw (Acolyte) on Jul 03, 2022 at 13:04 UTC
    I don't understand why one shouldn't use expressions inside macros. If you comply with using symbols that don't clash with those of callers, expressions should be no different than a simple variable, as far as I understand
      In general, the more complex expression you put in a macro the more likely it is to trigger some syntax mishap in the expansion of the macro. The main danger is if you use expressions with side effects, and then the macro evaluates it twice, which wasn't a factor here. But in general, macros are fragile, unlike inline functions which evaluate the expression once and then apply the rest of the inlined logic to those values. If you only ever pass bare variable names as arguments to a macro, it is least likely to give problems.