Related Projects > NASMX

Subtle Bug (I think)

(1/1)

pprocacci:
While reading through nasmx.inc trying to learn nasm's preprocessor since it's godly, I was trying to invoke the %else in the below snippet:



--- Code: ---nasmx.inc: line 1248-1255


%iftoken %{2}_size
%assign %%__argsize %{2}_size
%if (%%__argsize < 1)
%fatal invalid size for %{$__nx_name}.%{1}: %{2}
%endif
%else
%fatal unknown size for %{$__nx_name}.%{1}: %{2}
%endif

--- End code ---


I couldn't.  Everything I was throwing at this test was always returning true.

A sample of what I was trying:


--- Code: ---%include 'nasmx.inc'

NASMX_STRUC POINT
 NASMX_RESERVE x, yadda, 1
 NASMX_RESERVE y, uint32_t, 1
NASMX_ENDSTRUC

--- End code ---

Now, it's possible that I'm simply doing it wrong, and quite frankly if it works, why should I care right?
It just bothers me that ${2}_size evaluates to a true value even when it isn't defined as a token as yadda_size for instance isn't defined.

Am I missing something?

Navigation

[0] Message Index

Go to full version