NASM - The Netwide Assembler

NASM Forum => Programming with NASM => Topic started by: nobody on February 21, 2005, 09:44:40 PM

Title: nasm treats negative numbers as non numbers!
Post by: nobody on February 21, 2005, 09:44:40 PM
try doing this

%ifnnum -1
  %error "-1 is not a number."
%endif
Title: Re: nasm treats negative numbers as non numbers!
Post by: Frank Kotler on February 22, 2005, 04:43:03 AM
Yeah, Nasm's a little brain-dead on this issue - just looks to see if the *first* character's a decimal digit. The "workaround" is to use "0-1" - kinda ugly, but you get used to it :)

We may get that fixed... someday... it's easy to get used to, honest! (if it wasn't, I suppose it would have been fixed by now :)

Best,
Frank
Title: Re: nasm treats negative numbers as non numbers!
Post by: nasm64developer on February 22, 2005, 02:13:21 PM
> Yeah, Nasm's a little brain-dead on this issue

No, it isn't. Instead the NASM preprocessor is
behaving as expected. The term "-1" consists of
two tokens, "-" and "1". And "-" isn't a number.

> We may get that fixed

Doing so would break the preprocessor's logic.
As well as backwards compatibility.
Title: Re: nasm treats negative numbers as non numbers!
Post by: nobody on March 04, 2005, 07:38:55 AM
0y is also a number for nasm's preprocessor.
Very its preprocessor's logic is quite other than its assembler's logic.

%ifnum 0y
%error 0y is a number
%endif