Wiki source for KeyPgOpPpStringize


Show raw source

{{fbdoc item="title" value="Operator # (Preprocessor Stringize)"}}----
Preprocessor operator to convert macro arguments to strings

{{fbdoc item="syntax"}}##
**""#""**//macro_argument//
##
{{fbdoc item="desc"}}
This operator converts the ##//macro_argument//## into a string whose value is the name of the argument. This substitution is made during the macro expansion, previous to compilation.

~&//Note: because of this feature, care should be taken when using file-handling statements in a macro. Because of potential ambiguity with file-handling statements that take a "##**#**//filenum//##" parameter, if ##//filenum//## is one of the macro parameters, it may be necessary to wrap the ##//filenum//## expression in parenthesis (e.g. "##**#**(//filenum//)##"), to separate it from the ##**#**## sign. Otherwise, ##//filenum//## will be stringized in the macro.//

{{fbdoc item="ex"}}
{{fbdoc item="filename" value="examples/manual/prepro/stringize.bas"}}%%(freebasic)
#define SEE(x) print #x ;" = "; x
dim variable as integer, another_one as integer
variable=1
another_one=2
SEE(variable)
SEE(another_one)
%%

Output:
%%
variable = 1
another_one = 2
%%

{{fbdoc item="diff"}}
- New to ""FreeBASIC""

{{fbdoc item="see"}}
- [[CatPgPreProcess|Preprocessor]]

{{fbdoc item="back" value="CatPgOpPrepro|Preprocessor Operators"}}{{fbdoc item="back" value="CatPgOperators|Operators"}}
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki



sf.net phatcode