Author Topic: Subtle Bug (I think)  (Read 10696 times)

Offline pprocacci

  • Jr. Member
  • *
  • Posts: 11
Subtle Bug (I think)
« on: June 04, 2019, 01:55:02 AM »
While reading through trying to learn nasm's preprocessor since it's godly, I was trying to invoke the %else in the below snippet:

Code: [Select] line 1248-1255

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

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

A sample of what I was trying:

Code: [Select]
%include ''

 NASMX_RESERVE x, yadda, 1
 NASMX_RESERVE y, uint32_t, 1

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?