Discussion:
Multiple lines comments in Nasm
(too old to reply)
Hein Matzon
2005-03-08 19:22:53 UTC
Permalink
Hi,

Does anyone know how to comment multiple lines in Nasm? I hate commenting
each line separately when I want to disable a block of code.
Is there something like /* ...... */ like C/C++?

Thanks in advance.
Matt
2005-03-08 20:23:48 UTC
Permalink
Post by Hein Matzon
Hi,
Does anyone know how to comment multiple lines in Nasm? I hate
commenting each line separately when I want to disable a block of
code.
Is there something like /* ...... */ like C/C++?
Why not:
%if 0
; Code
%endif ; 0

-Matt
Frank Kotler
2005-03-08 23:08:41 UTC
Permalink
Post by Hein Matzon
Hi,
Does anyone know how to comment multiple lines in Nasm? I hate commenting
each line separately when I want to disable a block of code.
Is there something like /* ...... */ like C/C++?
No. You can use "%if 0"..."%endif" - or "%ifdef _ALLCODE_"
or something if you want to enable/disable a block from the
command line...

Best,
Frank
Ivan Ngeow
2005-04-25 05:17:47 UTC
Permalink
Post by Frank Kotler
No. You can use "%if 0"..."%endif" - or "%ifdef _ALLCODE_"
or something if you want to enable/disable a block from the
command line...
I like to use

%ifdef COMMENT
......
%endif

because that's self-documenting. ;-)


-ivan

IIJIMA Hiromitsu
2005-03-09 00:51:43 UTC
Permalink
Post by Hein Matzon
Does anyone know how to comment multiple lines in Nasm? I hate commenting
each line separately when I want to disable a block of code.
Is there something like /* ...... */ like C/C++?
As Matt and Frank mentioned, %if 0 should work.




P.S.
You should not use /* .... */ for disabling a block of code.
Consider this:

/*------- I want to disable from here

/* open configuration file */
if (fpConfig=fopen(szConfigFilename,"r"), fpConfig==NULL)
{
printf("%s not found, so create it.\n",szConfigFilename);
return createConfigFile(xzConfigFile)
}

---------- disabled code ends here ------*/

Being strict to the grammar, '/*' on the first line ends at the third line.
In this case, #if 0 ..... #endif should be used instead.
Loading...