NASM - The Netwide Assembler
NASM Forum => Using NASM => Topic started by: cinolt on May 11, 2017, 05:27:36 AM
-
Straight from the docs in section 4.1.1:
%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.
-
Hi cinolt,
Welcome to the Forum.
What I see in the Friendly Manual is:
%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.
%define a(x) 1+a(x)
is, in fact, interminable.
Am I looking in the wrong place in the Manual?
Best,
Frank
-
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?
mov ax, 1 + a(3)
?
Straighten me out here...
Best,
Frank
-
My use-case for this feature isn't really simple to explain, basically I was trying to do something like:
%define BLAH BLAH
for some hacky work-around stuff I was trying to do. In either case the documentation should be updated.