Author Topic: "interminable macro recursion" error  (Read 8150 times)

Offline cinolt

  • Jr. Member
  • *
  • Posts: 2
"interminable macro recursion" error
« on: May 11, 2017, 05:27:36 AM »
Straight from the docs in section 4.1.1:

Code: [Select]
%define a(x)    1+a(x)

        mov     ax,a(3)

a(3) is supposed to expand only once, but NASM complains with "error: interminable macro recursion".

So, this is either a bug in NASM itself or a bug within the docs.

Tested with versions 2.10.07 and 2.13.01.

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: "interminable macro recursion" error
« Reply #1 on: May 11, 2017, 06:03:28 AM »
Hi cinolt,

Welcome to the Forum.

What I see in the Friendly Manual is:
Code: [Select]
%define a(x)    1+b(x)
%define b(x)    2*x

        mov     ax,a(8)
which is not the same as the code you've posted.

Code: [Select]
%define a(x)    1+a(x)
is, in fact, interminable.

Am I looking in the wrong place in the Manual?

Best,
Frank


Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: "interminable macro recursion" error
« Reply #2 on: May 11, 2017, 06:34:26 AM »
Okay, my apologies, I didn't read far enough. It does say it'll do that. Although it may be an error in Nasm, I'd treat it as an error in the documentation. Seems to me like an "obviously wrong" thing to try to do.

Do you have something in mind for this? What would you like it to expand to?
Code: [Select]
mov ax, 1 + a(3)
?

Straighten me out here...

Best,
Frank


Offline cinolt

  • Jr. Member
  • *
  • Posts: 2
Re: "interminable macro recursion" error
« Reply #3 on: May 11, 2017, 06:58:11 AM »
My use-case for this feature isn't really simple to explain, basically I was trying to do something like:

Code: [Select]
%define BLAH BLAH
for some hacky work-around stuff I was trying to do. In either case the documentation should be updated.